• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Singleton Session Bean - PostConstruct/PreDestroy are Transactional?

 
Anirudh Gupta
Ranch Hand
Posts: 49
Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PostConstruct and PreDestroy methods of Singletons with container-managed transactions are transactional.

What are the semantics of the above statement?
Why in the first place do these methods have to be in a transaction context in the first place?
 
Joemon Anthony
Greenhorn
Posts: 26
Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anirudh,
As you might know that Transactional Attributes comes into picture, when your service is associated with a Transaction. If you do not want any transaction from your service then you can use NOT_SUPPORTED Transactional Attribute. But sometimes it can be useful to complete transactional activities during the PostConstruct and PreDestroy life cycle interceptor callbacks for example : logging purpose. So by making PostConstruct and PreDestroy transactional, gives freedom to the developer to write any transactional statements in that.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic