• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!
 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got it!!! Tks Amol !!! ;-)
 
reply
    Bookmark Topic Watch Topic
  • New Topic