• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

execution of the ejbfind method

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
My honeysuckle is blooming this year! Now to fertilize this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic