aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes why we are using ejbPostCreate() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "why we are using ejbPostCreate() " Watch "why we are using ejbPostCreate() " New topic
Author

why we are using ejbPostCreate()

basanta dwibedy
Greenhorn

Joined: Feb 05, 2007
Posts: 23
Hi ,



can any body give the answer why exactly in a Entity Bean we are using ejbPostCreate() method.

what is the exact differnece between ecjCreate() method and ejbPostCreate() method.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

ejbPostCreate gives you a chance to set cmr-fields. It is not possible in ejbCreate as the entity does not exist yet.


[My Blog]
All roads lead to JavaRanch
Vinay Raj
Ranch Hand

Joined: Jun 19, 2006
Posts: 81
To elaborate further. Relationship tables require the primary key information of the parent table of the relationship. Some times primary key generation is deferred to the database(e.g. trigger based PK generation). In such cases PKs are generated on completion of the ejbCreate method invocation. Hence an ejbPostCreate method is provided to retrieve the PK and assign it to the relationship tables.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why we are using ejbPostCreate()