| Author |
Singleton Session Bean - PostConstruct/PreDestroy are Transactional?
|
Anirudh Gupta
Greenhorn
Joined: Dec 08, 2010
Posts: 20
|
|
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
Joined: May 22, 2011
Posts: 22
|
|
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.
|
(SCJP 5, OCA 9i)
(Always interested in learning)
|
 |
 |
|
|
subject: Singleton Session Bean - PostConstruct/PreDestroy are Transactional?
|
|
|