This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

ejbcreate() in CMP entity

 
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
??
 
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.
 
Everyone is a villain in someone else's story. Especially this devious tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic