Results 1 to 3 of 3

Thread: OpenSessionInView and jboss TransactionManager

  1. #1
    Join Date
    Aug 2004
    Location
    New York
    Posts
    168

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    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,
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  3. #3
    Join Date
    Aug 2004
    Location
    Vrhnika, Slovenia
    Posts
    133

    Default 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 at 10:32 AM.

Similar Threads

  1. OpenSessionInView + CMT Session usage
    By alesj in forum Data
    Replies: 7
    Last Post: Aug 16th, 2005, 02:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •