File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Doubt on finder methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Doubt on finder methods" Watch "Doubt on finder methods" New topic
Author

Doubt on finder methods

KRK Gowda
Ranch Hand

Joined: Nov 02, 2004
Posts: 132
Hi All,
Can anybody explain me influence of finder methods on life cycle of entity beans?
Where the finder methods come into picture in lifecycle?
What happens in the background when a client invokes a finder method?


Thanks and Regards,
Awishek sinha
Ranch Hand

Joined: Jun 24, 2007
Posts: 62
Hi Gowda
Finder methods in entity bean does not have any influence on its lifecycle.(i.e invoking these methods does not cahnges the state of entity bean)
It can be called on two stages of entity bean lifecycle
1.Polled state
2.Ready state
What happens in the background when a client invokes a finder method?
For CMT bean the bean provider does not have to define these methods in bean class it is implemented by the container from the info provided in the Deployment descriptor using EJB-QL by bean provider.So when the client calls this finder method the container invokes this implemented method to give back the result.
For BMT bean the bean provider has to write the finder method in the bean class.
Let me know if it clears your doubt.


Awishek Kr Sinha<br />SCJP 1.4<br />SCBCD 1.3
KRK Gowda
Ranch Hand

Joined: Nov 02, 2004
Posts: 132
Hi Awishek,
I want to know what happens when the client calls finder methods? How does container pulls beans out of pools and assign them task of finding a given primary key?

Thanks and Regards,
Awishek sinha
Ranch Hand

Joined: Jun 24, 2007
Posts: 62
Hi Gowda
let me tell my understanding..
The container does not pull the bean instance out of the pool(state cahge does not happens) to execute the finder method, it select one of the bean instance and call the finder method implemented by the container(CMT), and returns the ejbobject having primary key assigned to it( at that time the bean context is not assigned the primary key..)
once the client call the businees method on ejbobject stub then only the primary key may assigned to session context and it represent that entity
It might slightly.. differ from vendor to vendor..
Hope it clears your doubt..
KRK Gowda
Ranch Hand

Joined: Nov 02, 2004
Posts: 132
Hi awishek,
Thanks for the reply. I overlook page that describes lifecycle of finder methods and create methods in the book.
I got it now.

Thanks and Regards,
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Doubt on finder methods