Hibernate 2
Basically, what I'm trying to do is something like this (this is just an example, please don't read into it beyond the connection issues):
Code:
//open session from factory
Object o = session.find( finderHql );
connection = session.connection();
statement = connection.createStatement();
results = statement.executeQuery( reportSql );
//process report results
//close Statement and ResultSet in finally
Now I'm here with a Connection object and a Session. If I close the connection with connection.close(), Hibernate will bonk on session.close() or if I try to load/update any more Hibernate objects. If I DON'T close the connection manually, it remains open after I call session.close() and hangs the app...
Does anyone know a way around this? I'd like to be able to check for an open connection and make closing decisions. the session.connection object is null throughout the Session's life unless (and until) session.connection() is called...Then that connection doesn't seem to close after the session is closed...
Also, session.isConnected() returns false even after connection.close() is called.