This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PostConstruct and PreDestroy Callbacks

 
Joe Harry
Ranch Hand
Posts: 10091
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I got this from MK's notes,

"PostConstruct and PreDestroy methods are invoked in an unspecified transaction context and security context."

So we don't have to associate these container callbacks with any transaction context? Any reasons please!
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jothi Shankar Kumar Sankararaj:
Guys,

I got this from MK's notes,

"PostConstruct and PreDestroy methods are invoked in an unspecified transaction context and security context."

So we don't have to associate these container callbacks with any transaction context? Any reasons please!


PostConstruct and PreDestroy methods are invoked by container for initialization and destruction purpose. These methods are not anyway related to your business methods. I think for this reason, this transaction are not running in the active transaction in which the business logic is handled.
I EJB specification enforce the above conditions.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic