Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Entity bean question - HFEJB pag 364, exe: 10!

 
Steven Colley
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Accordint to this question:

10- What is TRUE for CMP beans in the READY state?

A - its ejbLoad() can be direclty called after ejbStore()
B - its ejbStore can be called directly after a business method.
C - One of its business methods can be called directly after ejbStore.

The asnwer is : A, B, C

Note from HFEJB: "The point is..:load , store and business methods can be called by the container in any order.."

My question is...: what about these sentences below:

- "ejbLoad() will be always called AFTER ejbActivate()"
- "ejbStore() will be always called BEFORE ejbPassivate()"


- Doesn't it have to do with?
- Is it just because the bean is the READY-STATE?

Please advise!!!

Tks so much!!
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ejbLoad and ejbStore are called to synchronize the bean's state with the db,

So they can be called any time and not necessarily after ejbActivate and before ejbPassivate respectively.

The spec says

When an entity bean instance is in the ready state, the instance is associated with a specific
entity object identity. While the instance is in the ready state, the container can synchronize the
state of the instance with the state of the entity in the underlying data source whenever it determines
the need to, in the process invoking the ejbLoad and ejbStore methods zero or
more times. A business method can be invoked on the instance zero or more times. The ejb-
Timeout method can be invoked on the instance zero or more times. Invocations of the ejb-
Load and ejbStore methods can be arbitrarily mixed with invocations of business methods
and ejbTimeout method invocations. An ejbSelect<METHOD> method can be called by
a business method (or ejbLoad or ejbStore method or ejbTimeout method ) while the
instance is in the ready state.
 
Steven Colley
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it!!! Tks Amol !!! ;-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic