1 Reply Latest reply on May 1, 2009 9:24 AM by Max Rydahl Andersen

    Disconnect Hibernate from database after HQL query

    Ross Johnson Newbie

      When I use the Hibernate HQL editor to test a query on the database, the connection remains open afterwards. I can't seem to find any way of asking for it to be closed. Is such an option hidden somewhere?

      I am running an in-process hsqldb instance. While Hibernate holds the connection, I can't connect using the JPA related tools. I will look into using server mode, which should allow me to connect from JPA and issue a shutdown. But that's not a very elegant way of working.

      I also tried changing the database connection in the Hibernate console launch profile from 'hibernate configured connection' to 'JPA project configured connection'. This didn't really work either. When Hibernate needed a connection, JPA opened it but Hibernate subsequently threw an exception saying the database is in use and a connection couldn't be opened! At least I could then close that database connection from a JPA view.

      What am I missing here?

      I'm using:
      - JBoss Tools: 3.0.0.GA-R200903141626-H5
      - Seam: 2.1.1.GA
      - Eclipse 3.4.2
      - JDK 6 update 13

      Thanks, Ross.