What is the difference between ejbStore() and ejbLoad()

Answered by Jey on 2005-05-08 11:06:46: When the EJB container needs to synchronize the instance variables of an entity bean with the corresponding values stored in a database, it invokes the ejbLoad and  ejbStore methods. The ejbLoad method refreshes the instance variables from the database, and the ejbStore method writes the variables to the database. The client cannot call ejbLoad and ejbStore.

Showing Answers 1 - 3 of 3 Answers

Jey

  • May 8th, 2005
 

When the EJB container needs to synchronize the instance variables of an entity bean with the corresponding values stored in a database, it invokes the ejbLoad and 
ejbStore methods. The ejbLoad method refreshes the instance variables from 
the database, and the ejbStore method writes the variables to the database. The 
client cannot call ejbLoad and ejbStore.

  Was this answer useful?  Yes

Sanjay Guha

  • May 25th, 2005
 

ejbLoad method: 
This method is called when it is necessary to synchronize the bean with data from the database. This will most likely trigger a SELECT to occur. The ejbLoad is triggered when the client requests to use the bean, forcing activation to happen, thus moving it to the ready pool. 
 
ejbStore method: 
This method is called when it is necessary to synchronize the bean data with the database. This will most likely trigger an UPDATE to occur. The ejbStore is triggered when the bean is no longer being used by a client, and the container decides to move the ready instance back into the pooled state.nullejbLoad method:ejbStore method:

  Was this answer useful?  Yes

Vj

  • Jul 22nd, 2005
 

Note: ejbLoad and ejbStore methods are to be coded only if you are creating a BMP. For CMP these methods are handled by the container.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions