I'd greatly appreciate if you could help figure out the following.
ejbLoad() and ejbStore() can run on an entity bean that is in a method ready state. The bean can be in a such state when a client invoked a business method or commit option A /commit option B is used (bean remains in a method ready state, just does not service any client's call).
Q1. How many times are ejbLoad()/ejbStore() called per transaction? Can they be called more than once?
My answer would be that these methods are invoked at least once (but can be invoked more than once) per transaction. That is what the spec says (section 10.5.1):
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.
Q2. Can ejbLoad()/ejbStore() be invoked on a bean that is in a method-ready state but not in a transaction (i.e. uses commit option A or B and does not currently service the client's method call)?
If ejbLoad()/ejbStore() CAN be invoked on a bean that does not currently service the client's method call (as far as I can see there is nothing in the spec that says otherwise, refer to the quote from the spec above) the transaction context will be "unspecified" plus there is no client security info (bean does not service any client's method call).
However, the spec says that the entity bean can access resource managers/other beans plus get client security info and trnx related information when in ejbLoad()/ejbStore() (section 10.5.5). This where I get confused
If ejbLoad()/ejbStore() CANNOT be invoked on a bean that does not currently service the client's method call then everything is clear

. In this case a bean will always be associated with the client and run in "meaningful transaction context" (provided that a business method that caused these methods' invocation has appropriate transaction attribute) when ejbLoad()/ejbStore() is invoked by the container on the bean.
Thanks a lot for reading and your answers.
[ June 30, 2004: Message edited by: Alex Sharkoff ]
[ June 30, 2004: Message edited by: Alex Sharkoff ]