Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on Entity Beans

 
KRK Gowda
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I was going through "Entity Beans are Persistent" chapter in HF EJB and found this following doubt.
In the page 281, i read, "ejbCreate () will be called on beans in the pool. Container does not make a new entity bean"
I couldnt understand above sentence. Can anybody explain how it works?

Thanks and Regards,
 
Aakash Parashar
Ranch Hand
Posts: 123
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

It means ejbCreate is called on the bean instances which are in pooled state. Entity beans lifecycle is different from other beans.

It like new instance --> setEntityContontext --> pooled state --> ejbCreate
 
Awishek sinha
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gowda
When the client want to insert an entity into persistant storage,(database) it calls create(..) which in turns container pulls the bean instance (which just holds the entity context) and passes the arg provided by the client in create method by calling ejbCreate(..)on the bean instance in this method the bean provider assign the value to the persistant feild of the bean which makes the primary key and then it insert the entity and assign this primary key to the EntityContext & EJBObject and now this entity bean instance represent the the inserted entity in database.
Hope it clears your doubt..
 
KRK Gowda
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you guys
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic