• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

finder about entity bean

 
Timber Lee
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
true or false?
The ejbFindByPrimaryKey() method does not cause an EJB instance to become associated with a particular database row;it merely verifies that the row exists.(this is described on some articles on EJB)
I am confused, I could create instance that was associated with a particular database row by ejbFindByPrimaryKey() method when I used some ejb containers.
 
Andrew Turnbull
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there.
False!
ejbFindByPrimaryKey() is just like any other finder method that returns a single record: If a representation of your primary key can be found in the database, then the container will create the remote and local objects for the client to invoke business methods on, and associate an entity bean instance with those objects at that point.
The confusion possibly arises from the lifecycle statechart diagrams describing entity beans (see Mastering EJB2 Appendix E). These show the bean remianing in the pooled state after an ejbFind method has been called (after a client called a finder method on the home interface).
This implies that the bean remains in the pooled state after you ejbFind method has executed - which is a little befuddling...
What I'm guessing happens is that the container returns a remote and local interface to a bean which is either already in the ready state, or is activated by the container when you call a finder method. The home object on which you called your finder method might not be one of those beans referenced, and hence might well stay in the pooled state.
I hope that helps, and doesn't confuse the matter. I myself am a little confused over the entity bean lifecycle diagram, as I don't see why these diagrams imply a state relationship between an ejbHome object and a bean instance - these seem to be two separate container managed entities to me.
Can anyone else shed any light on this?
Cheers, Andy
[ February 09, 2003: Message edited by: Andrew Turnbull ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic