Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PostConstruct and PreDestroy Callbacks

 
Joe Harry
Ranch Hand
Posts: 10124
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