Hi to all,
I am new whit hibernate and have a "little problem":
I am integrating hibernate into an existing web application, so I have to use the Session.connection() method to obtain a connection. All work, but in some cases that's something strange.
This is the sequence:
Code:
3*
PreparedStatement ps=Connection.prepareStatement("sql");
ResultSet rs=ps.executeQuery();
do{
4*
5*
6* }while(rs.next());
1) //web request, open session by hibernate
2) //obtain a connection by calling Session.connection() to work with old business objects
3) //execute a select with connection and ResultSet
4) // do some work with connection and "only load" new objects whit hibernate
5) //insert with connection and old object
6) //call resultSet.next() until there is records from point 3
the problem is at point 6. If i load new object with hibernate session, when i call rs.next() it throws an
Code:
java.sql.SQLException: Connection closed: next
if I remove the loading by hibernate session the next() works.
The strang think is that if i put some System.out just before next() call, this is the state of connection/session:
Code:
java.sql.Connection.isClosed() : false
getHibernateSessionDB().isConnected() : true
getHibernateSessionDB().isDirty() : false
getHibernateSessionDB().isOpen() : true
thanks to all