• Post Reply Bookmark Topic Watch Topic
  • New Topic

ejbLoad() and ejbStore()

 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any body explain when all will be ejbLoad() and ejbStore() is called by container..For example at the time of findByPrimaryKey() it will be executing load loke that. I mean once bean is instantiated what are the time it is called.
 
Shakti Sharma
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is totaly dependent on container when to call these method. mostly when you call findByprimary key, after successful completion of findBy method container allocate new instance from the pool to newly created EJBObject. Then Entity context information is updated in EntityContext object of the allocated instance to reflect the associated Entity. After that, it will call ejbLoad. ejbLaod and ejbStore method is also called when you call any business method, but actual implemention is totaly dependent upon the container.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dependent on the container my foot! This is all defined CLEARLY in the EJB specification and the container vendors get very little latitude in interpreting it. About the only vendor-specific implementation detail is that most vendors will support NOT calling ejbStore() in what are called "read-only" EJB's -- which must usually be marked in a special vendor-specific deployment descriptor.
Kyle
 
Rahul JG
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right Kyle.
Its all clearly mentioned in the EJB specs.
Here it is:
Before invoking the ejbFind<METHOD> method, the container must first synchronize the state of any entity bean instances that are participating in the same transaction context as is used to execute the ejbFind<METHOD> by invoking the ejbStore() method on those entity bean instances.
Mathews:
Going through the EJB specs will clear most of the confusion. Relying just on articles lying on the net can be dangerous, 'coz I have seen many articles which contradict the specs.
Rahul Gokhale
IBM - Delhi.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!