Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

purpose of ejbPostCreate method

 
Gaurav Chugh
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

Can anybody explain me the purpose of having the ejbPostCreate<method> , what are the responsibity of ejbCreate<method> and what left to do in the post create method and one more thing if there is no create method , then how entity will be created ,is it created by finder method ?

Thanks in advance.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I won't give you a full answer, as it is too long to explain.
Basically, after ejbCreate has been called, the entity exists and has a primary key.
What you can do in doPostCreate is setting the CMR fields for example.
You can get the primary key by calling getPrimaryKey(). You can pass a reference to the component interface of the bean to another bean.


if there is no create method , then how entity will be created ,is it created by finder method ?

You're misunderstanding the concept of ejbCreate. ejbCreate will insert some data in a persistent store.
Finder methods only looks for data, and the retrieved data is set into a bean by the container.
Create methods are not called here.
 
Gaurav Chugh
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic