I got into a problem if somebody can be kind enough to help me.
According to Ed Roman(page 135 of the book and 167 of the .pdf):
The finder process works as follows:
1-When the client invokes the home object’s finder, the home object asks a bean to find all primary keys matching the client’s criteria. The bean then returns a collection of those primary keys to the container.
2- When the container receives the collection of keys from the entity bean instance, it creates a collection of EJB objects, one for each primary key, and returns those EJB objects in its own collection to the client.
Now the question is when the container returns the collection of EJB Objects to the client do these EJB Objects have Bean instances associated with them or they are associated when the first method on this EJB Object is invoked??????
And if you think behavior of different Containers may be different on this issue..then plz quote some example.
waiting for your help.
The spec does not dictate whether or not EJB objects (designated by the local/remote references returned by the container) will have associated bean instances. There is no rule I can quote: the spec simply neither requires nor prohibits having a bean instance associated with each EJB object. You'll have to trust me, or read the entire spec yourself to find out there is no such rule :)
AFAIK most containers will usually assign a bean instance when a method is invoked.
I completely agree with Gal. I think EJB specs do not specify "neither requires nor prohibits having a bean instance associated with each EJB object".
I think I can give you an example from weblogic. There is a deployment descriptor "finders-load-bean" which is set to true by default and will load the bean instance after finder method is called. Otherwise the behaivour will be consistent with ejb1.1 where container would allot a bean instance after a business method is called on the bean