• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

SessionSynchronization Clarification

Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Under what situation do we want to use SessionSynchronization to get notification of transaction status? Many books says we load data from db in afterBegin() & write the changes in beforeCompletion(). But it is difficult for me to imagine the situation we want to do this. It seems that it is applicable only when we spread the transaction across many methods? Am I correct?

If I have a CMT SFSB where every method starts a new txn and complete it b4 returning, how do we use the SessionSynchronization methods ?

Appreciate anyone can share a real life situation they encountered that really need to use SessionSynchronization bean in the design.
Author & Gold Digger
Posts: 7617
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In this article, BEA folks share some experience on the use of the SessionSynchronization interface.

the typical use case of the SessionSynchronization interface is a stateful session bean with its beforeCompletion method containing an implementation that flushes any state that may have been cached before the commit processing begins (of course, if state is cached when the transaction is committed, then it will never be written to the back-end storage). The afterCompletion implementation, when the final result is a JTA rollback, will likely return the session state to some values saved prior to its commencement.

Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic