0 Replies Latest reply on Jul 11, 2005 4:55 PM by yanka

    Hibernate 3.0 MBean in JBoss 4.0 - JDBC connection closed af

    yanka

      Through the Hibernate MBean, how does one configure standard hibernate properties aside from the hibernate mbean properties listed here: http://docs.jboss.org/jbossas/jboss4guide/r3/html/ch13.html#ch13.config.table. I've tried using a hibernate.properties file with no success.

      The issue I'm trying to resolve is that the hibernate mbean in JBoss is closing the JDBC connection after every sql statement. The logs indicate aggressive release to be enabled and I am hoping that setting hibernate.connection.release_mode to something other than after_statement will resolve this issue. Key parts of the function in question is posted below:

      public void function() {
      
       Session s = HibernateUtil.currentSession();
      
       TableObject obj = (TableObject)s.get(TableObject.class, id);
       /* for the above line Hibernate opens a JDBC connection,
       obtains a resultSet, and then closes the JDBC connection */
      
       obj.setValue(10);
       obj.setValue2(20);
      
       s.update(obj);
       s.flush();
       /* for the above line Hibernate opens a JDBC connection,
       sends a update query, and then closes the JDBC connection */
      
       HibernateUtil.closeSession();
      }
      
      


      where HibernateUtil contains a static SessionFactory object that is instantiated through a JNDI lookup as well as a static ThreadLocal object that stores a currently opened session.