I used to go crazy to understand this concept. But some how I got it. Thanx to one of my friend.This ejbPostCreate is used in a very rare situation. Before telling the situation, let me explain the difference between (or relationship) between ejbCreate and ejbPostCreate in Entity Bean. ejbPostCreate() is called by the EJB Container after the ejbCreate().The only difference is ejbPostCreate method will have the reference to the ejbObject and ejbCreate() will not have reference to ejbObject. So when you have a child parent relationship between two beans , and when you are loading the parent Bean you want to load or intialize the child bean. Then when you want to load the child bean you need to pass the instance of the Parent Bean.So you could not intialize the child bean in the ejbCreate of the parent bean as you will not have the reference to the ejbObject ( remember the bean reference passed is always ejbObject not "this" i.e.., the bean itself) . That is why we need a extra method in case of Entity bean to intialize the Child Bean I hope I have explained , but let me know if I am not clear. This is a very easy concept, but a hard one to explain
Hey shiva kumar, Thanks for that detailed reply.I knew that postcreate is called after the bean in associated with the entity instance in the underlying database.What i did not know is where i need to use it.Your parent child case is a good situation thanks