• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Moving Entity Bean From Pooled to Ready State--help.

 
Boniface Kabaso
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the Spec, there are only two ways to move an entity bean from Pooled state to the Ready State, i.e ejbCreate and ejbActivate.
My question is why doesn't the ejbFind move the bean into the ready state? This is where my confusion is: the create method from home interfaces returns a component object and from the component object you can do you bussiness methods. Also from the find method from the home interface returns a component object which you can use to do your business methods. This makes sense bacause you can either enter DB records into the DB using create methods or just entering them straight into the DB using SQL and then using finder methods to work on them.
So, how would you associate entity bean in the ready state with the DB record that you entered directly using SQL without using ejbFind? Could someone kindly explain? I think I have all this mixed up.
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This seems to be good question to me. Can somebody explain this please.
P:169(EJB Spec2.0) does say that the bean instance does not move into Ready state from the pooled state, during the execution of a finder/home methods.
It does not explain why?
Coming to the last part of ur question,
"So, how would you associate entity bean in the ready state with the DB record that you entered directly using SQL without using ejbFind?"
I think you cannot access an entity bean with a row already created in the database thru some other means, without using an ejbFind method first.
ejbCreate method cannot be used for an already existing row, because the row already exists in the database and it might throw SQLExceptions due to db constraints.
ejbFind method has to be used to access the row/entity bean and the subsequent first business method call would transition the bean from the Pooled state to the Ready State.One example, I could think of is the Read-Only entity beans,which are accessed first thru the ejbFind methods.
 
Vipin Mohan
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends
This question has already been answered by Kathy in this thread.
http://www.coderanch.com/t/158255/java-EJB-SCBCD/certification/ejbFind-bean-state-change
Cheers
Vipin
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Vipin,
I overlooked it.
 
Boniface Kabaso
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Vish & Vipin. I have my smile back Am now clear about this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic