1 Reply Latest reply on Jan 28, 2005 2:34 PM by adrian.brock

    Trying to return an unknown connection2 / Hibernate

      Hello Adrian.

      About: JBoss3.2, Hibernate2.1.6, closing Hibernate Sessions/Connections.

      Scenario:
      -slsb uses SessionFactory to get a Session

      -own hibernate SessionFactory impl which when handing out a new Session in getSession() registers a new javax.transaction.Synchronization handler instance with the the TM.

      -the aim of the Synchronization handler is to close the Sessions in beforeCompletion / afterCompletion

      Q: is this design broken? On reading your post http://www.jboss.org/index.html?module=bb&op=viewtopic&t=49041 i started wondering if what i'm doing is such a good idea (open connection in context of ejb, closing it at the end of the tx).

      The Problem: This approach seems to work ok until my beans start calling other beans with tx attribute RequiresNew. Which is where i get said IllegalStateException: Trying to return an unknown connection2 when my Synchronisation handler tries to close the Hibernate Session.

      Also ConfigCachedConnectionManager has SpecCompliant=false, Debug=false...

      I'm not sure if what i'm describing is related to all the other reports of this exception.

      cheers