Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why we are using ejbPostCreate()

 
basanta dwibedy
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ejbPostCreate gives you a chance to set cmr-fields. It is not possible in ejbCreate as the entity does not exist yet.
 
Vinay Raj
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic