• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ejbcreate() in CMP entity

 
Victor Santos
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all !!!
I�m just confused . I was reading HFEJB and on page 396 they say that I cannot access a CMR field in ejbCreate() , only in ejbPostCreate() . But on page 338 they say that I can access another bean in ejbCreate() . I know that this method is called in a transaction context and at this point this methods knows security information about the client , so it is safe to access a resource manager and another bean ...
thanks , victor
 
Victor Santos
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
??
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both statements are true. You CAN do whatever you want with other resources in ejbCreate since you're in a transactional context. However, the bean doesn't yet exist in the underlying database when ejbCreate is executing. It is created by the EJB container after ejbCreate finishes, but before ejbPostCreate starts to execute. Ergo, you should initialize CMR fields in your ejbPostCreate method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic