Originally posted by Rashmi Tambe:
It is a must condition for ejbFind methods to be executed by beans in a pooled state? So does this mean that a bean in ready state wont ever execute ejbFind? Why this is not applied to ejbSelect? i am not sure abt this...i mean, is it detected by ejb specs?
Can u explain more...
Please refer : EJB Specs 10.5.1 - Instance Life cycle.(p:168-169)
There is a good diagram showing, the methods of an entity bean and the states in which they are executed...and also the explanation in the below 3 paragraphs...
As pradeep said, if the ejbSelect methods are called from the home business methods, then they are executed by beans in the pooled state but if they are called from remote business methods, then they are executed by beans in the ready state...
Even though the spec uses the friendly ambiguous words "may" and "can", I think that the ejbFind methods and the ejbHome business methods are executed by the beans only in the pooled state.
Say for example: if there are 2 entity beans in the pooled state, A and B.
If I call a finder() method for the first time, bean instance A may be used to execute my ejbFinder() method. Then say, I call a remote business method, then also the container may choose the bean instance A, move it to the Ready State and execute the business method. Now if I call another finder method on the same home interface, then I think it might be the instance B in the Pooled state which will be selected for the ejbFinder method execution and not instance A, which is already in the Ready state.