Hello,
we have huge amounts of data, that are usually read and updated like this:
Code:
tx = session.beginTransaction();
ScrollableResults scroll = session.createQuery("from " + Employee.class.getName())
.scroll(ScrollMode.FORWARD_ONLY);
while (scroll.next()) {
Employee emp = (Employee) scroll.get()[0];
emp.setFirstName("abc");
session.update(emp);
tx.commit();
}
scroll.close();
In hibernate versions before 5.2, this was no problem, since cursor queries lived as long a they were not closed
manually. However in hibernate 5.2 this does not work, since all queries are close on commit, resulting in an Excepton in scroll.next():
org.hibernate.exception.GenericJDBCException: could not advance using next()
In older hibernate version there was an option like
ConnectionReleaseMode.ON_CLOSE
so that cursor queries survived the commmit.
But in hibernate 5 the ConnectionReleaseMode.ON_CLOSE does still close the cursor queries.
We probable missed something?