• Post Reply Bookmark Topic Watch Topic
  • New Topic

CMP load and store

 
william kane
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have read that for the CMP Entity bean the method ejbLoad is called AFTER that state of the bean is refreshed with that of the Database and ejbStore is called BEFORE the state of the entity bean is updated in the database.How does this work?When in a BMP load and store are the methods IN which that data sychronization takes place.
Thanks,
William
 
Nadeem Awad
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear William,
Please refer to the EJB 2.0 Specs, Chapter 12 Entity Bean Component Contract for Bean-Managed Persistence, Section 12.1.3 Instance Life Cycle, Page 248, Third Bullet Point:

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 invoke the ejbLoad() and ejbStore() methods zero or more times. A business method can be invoked on the instance zero or more times. Invocations of the ejbLoad() and ejbStore() methods can be arbitrarily mixed with invocations of business methods. The purpose of the ejbLoad and ejbStore methods is to synchronize the state of the instance with the state of the entity in the underlying data source�the container can invoke these methods whenever it determines a need to synchronize the instance�s state.


Also check out Section 12.1.6 (Caching of entity state and the ejbLoad and ejbStore methods), Page 258 for further details.

For CMP beans it is similar, you can find it in Chapter 10 Entity Bean Component Contract for Container-Managed Persistence, Section 10.5.1 Instance life cycle, Page 169, Third Buttlet Point.

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. Invocations of the ejbLoad() and ejbStore() methods can be arbitrarily mixed with invocations of business methods. An ejbSelect<METHOD> method can be called by a business
method (or ejbLoad() or ejbStore() method) while the instance is in the ready state.

[ July 12, 2005: Message edited by: Nadeem Awad ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!