Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

SessionSynchronization

 
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?
 
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.
 
His brain is the size of a cherry pit! About the size of this ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic