wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes execution of the ejbfind method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "execution of the ejbfind method" Watch "execution of the ejbfind method" New topic
Author

execution of the ejbfind method

william kane
Ranch Hand

Joined: Nov 21, 2000
Posts: 260
The EJB specification states that the request for a findMethods in entity beans will the served by bean instances in bean pool.Serving the find method does bring a bean to "ready"(outside the bean pool) state.How does this happen?If this is true where is the bean instance that is delegated the request that the ejbObject that is returned by the find method gets?
Hope i am clear about what i want.
thanks in advance
vamsi


Help me!Help you!!!
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
The container does pick a bean instance to use for running finders. But that bean is not really in a fit state to be used for business methods. It has no identity and ejbLoad has not been called so it has no state (no data).
When the (single valued) finder returns, the container needs an instance to use for the found bean. But it is free to return the finder's instance to the pool and use another instance for the found object. But many containers probably just reuse the instance that ran the finder.
That what you wanted to know?
[ October 03, 2002: Message edited by: Dave Landers ]
william kane
Ranch Hand

Joined: Nov 21, 2000
Posts: 260
hi dave,
Firstly let me tell u that error in typing has renderded my query indecipherable.I wanted to ask DONT the bean instances that serve the find method bring the bean instance out of the bean pool.Apologies for the same.
Your reply has never the less answered the query to some extent in stating that bean instance is not ready to serve business methods.
But,then what are we finding using the find method?why cant the find method return an ejbObject associated with a bean instance that equipped to run a business method(ejbLoad should be called)?
Why does do we need a diffent instance other than the instance that served the find method to serve business methods?
The EJB spec says:
The instance does not move to the ready state during the execution of a finder or a home method
Hope you got what i want
thanks again
william
william kane
Ranch Hand

Joined: Nov 21, 2000
Posts: 260
hi dave,
Firstly let me tell u that error in typing has renderded my query indecipherable.I wanted to ask why DONT the bean instances that serve the find method come out of the bean pool.
Your reply has never the less answered the query to some extent in stating that bean instance is not ready to serve business methods.
But,then what are we finding using the find method?why cant the find method return an ejbObject associated with a bean instance that equipped to run a business method(ejbLoad should be called)?
Why does do we need a diffent instance other than the instance that served the find method to serve business methods?
The EJB spec says:
The instance does not move to the ready state during the execution of a finder or a home method
Hope you got what i want
Apologies for the error in my prev query
thanks again
william
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
The finder method returns Primary Keys. It is an instance method on an object, so of course the container needs an object instance so it can run the method. So it pulls an object out of the pool.
Now, once your finder returns, the container is done with that instance and can put it back in the pool.
It now has one (or many) primary keys. It gets instance(s) from the pool and activates them and calls ejbLoad to initialize these instances with data for the primary key.
Unless you are trying to write a container, you really don't have to worry about this, except to know that home and finder mehtods are not "business methods". Even though they are run on an instance of the bean, the bean is not "ready" and has no state. So you shouldn't try to do things that a business method would do. Any data initialization you might try to do in a finder will not be saved - it will be lost and overwriten when the container activates/loads that instance again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: execution of the ejbfind method