• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SessionSynchronization

 
Ali Ragi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible that a session bean defines and uses a transaction enable method, but the bean NOT implementing the SessionSynchronization interface?
 
Sudhir V
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it is possible. Only if you need notifications associated with the transaction then u need to implement that interface.
Also make sure that when you implement the sessionsynchronization interface the methods must not be in unspecified transaction context i.e. only Required, RequiresNew and Mandatory transaction attributes must be used.
 
Ali Ragi
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!
... Also make sure that when you implement the sessionsynchronization interface the methods must not be in unspecified transaction context i.e. only Required, RequiresNew and Mandatory transaction attributes must be used.

So if I don't implement the sessionsynchronization, I don't have to follow that rule, and I can be in unspecified transaction context? or still have to follow the same rule?
[ February 29, 2004: Message edited by: Ali Ragi ]
 
Sudhir V
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB Spec Pg 351 says that:
"For a session bean, the transaction attributes must be specified for the methods defined in the bean�s component interface and all the direct and indirect superinterfaces of the component interface, excluding the methods of the javax.ejb.EJBObject or javax.ejb.EJBLocalObject interface. Transaction attributes must not be specified for the methods of a session bean�s home interface."
So you have to specify some transaction attribute but when using SessionSynchronization it must be either "Required", "RequiresNew", "Mandatory". See spec pg 352 5th Paragraph.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic