• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

ejbcreate() in CMP entity

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
??
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic