What code should go into the ejbPostCreate method? Why is it needed?
Each ejbCreate() method must have an corresponding ejbPostCreate method. Basically, the ejbPostCreate is used to perform additional work at creation time that could not be done in ejbCreate(). When ejbCreate() is invoked the bean does not have an EJBObject. After the ejbCreate returns , it provides a primary key to the container, allowing the container to construct an EJB Object for the bean. Now since the bean has an EJBObject, it is given an opportunity through ejbPostCreate to finish its creation work.
What Creation work ??? ::
This method is not useful for simple entity beans. But for complex inserts, it is a logical place in which to place code to insert dependent ancillary records.
If you want to enforce some security constraints after creation of bean. You can do it through ejbPostCreate method.
I am beginner in the field of EJB. & I had also the same problem that what to write in the
ejbPostCreate method.I am now very much cleared with the functionality of this method by ur replies.
But can you put more light on the securities constraints .An example will be preffered.
thanks a lot.