Announcement Announcement Module
No announcement yet.
Configurable Transaction Synchronization Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Configurable Transaction Synchronization

    In project, I am working on, we do need to switch between multiple open Hibernate sessions. Unfortunately, actual Spring codebase does use hardwired strategy Session-per-thread, which does not fullfill our requirements.
    I propose to make TransactionSynchronizationManager a full featured strategy bean instead of being a bag of static methods.

    This for example will allow:
    - hold Hibernate session open throughout multiple HTTP requests (long sessions/long transactions) (see JIRA issue SPR-679 )
    - different strategies for different Factories
    - manage more sessions in one thread (our case)

    I filled a JIRA issue SPR-746 on this topic.

    Please your comments, opinions


  • #2
    Backward compatibility

    Propsed solution will modify interface of some static stuff.
    Does anybody directly access methods from classes
    SessionFactoryUtils, DataSourceUtils, OjbFactoryUtils, TransactionSynchronizationManager and similar?



    • #3
      Jan, I'm faced with the exact same situation - see . I'm also have a heck of a time trying to extend AbstractPlatformTransactionManager for the same reason - it expects a single transaction object with hardwired calls to a single connection, etc.

      I personally think it would be great to have a "MultipleHibernateTransactionManager" but I don't have the wherewithall to write it, modify the core Spring classes to use it, refactor other impacted transaction managers, etc. Even worse, JTA isn't an option for me due to one of my legacy data sources being incapable of participating in transactions.