you need an ejbPostCreate() for each ejbCreate() because in case you have a relationship this must be set inside ejbPostCreate(). If you are thinking now "but why do I have to have it if I don't implement any relationship?", it's pretty obvious that the SUN engineers could not make "some" specification for "some other" cases. The specifications are general and should include all the cases. So if you don't implement any relationship you simply have an empty ejbPostCreate() with the same signature as ejbCreate().
...watch me...as I'm walking the path...
Joined: Oct 02, 2003
Can please explain me what type of relationship will be provided in the ejbpostcreate() method of a paticular ejbcreate() method. Regard, Sangeetha
Joined: Dec 16, 2003
For example you have two beans: Company and Employee in a 1 to N relationship (a company may have many employees). In the Employee table you have a field like "Company_PK". Here you could use a CMR (Container Managed Relationship) and for example when saving a new employee, you have to set a company to which that employee belongs to. So: 1) in ejbCreate() you save all the necesary data for the employee 2) in ejbPostCreate() you save the company (not as a BigDecimal/Double or whatever you use!) as a CompanyLocal:
setCompany(companyLocal); Read about CMR and this will clear out. hope this helps