Announcement Announcement Module
Collapse
No announcement yet.
OpenSessionInView and jboss TransactionManager Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • OpenSessionInView and jboss TransactionManager

    My application is currently configured to use the OpenSessionInView Filter in single session mode. Everything was working perfectly until I changed from the default hibernate transaction manager over to the Jboss implementation. For some reason it is creating a new session for each database access and closing the session.
    This is resulting in LazyInitialization exceptions.

    Is there an obvious configuration change I am missing when switching over to the Jboss container transactions?

    Thanks.

    Karl

  • #2
    Your post doesn't actually give enough details, but I presume you switched from using Spring's HibernateTransactionManager, to using Spring's JTATransactionManager.

    The main diference between these two setups is that in the former, a new Hibernate Session will be created together with the transaction, and bound to the current thread and associated with that transaction. Then any nested HibernateTemplate usage would pick that up. With the latter, the first usage of a HibernateTemplate (with the allowCreate flag set to true) would create a new session, and only then associate it with the current thread/transaction. To get the exact same behaviour, you would also have to add a HibernateInterceptor into the transaction definition. But all this changes is when the one session is created and bound, and doesn't explain your behaviour.

    What you are describing sounds almost like the OpenSessionInView filter is not kicking in, _and_ transactional wrapping itself is not kicking in. Changing from one transactionmanager to another should not affect this in any way. I would look at your config and logs more closely.

    Regards,

    Comment


    • #3
      Solved?

      Was this issue ever solved? Since I have (I believe) the same problem: http://forum.springframework.org/showthread.php?t=10910.

      Thanx, Ales
      Last edited by robyn; May 14th, 2006, 11:32 AM.

      Comment

      Working...
      X