Joined: Mon Nov 19, 2007 9:19 pm Posts: 1
|
I'm running an update sql and I'm having trouble committing my changes to the database. The row count for the update is what is expected but neither tx.commit nor session.flush() is flushing my changes to the database. Also the query seems to lock up the database because when I run a simple select on the table afterwards, the results take a long time to come back. The code is attached. Any help would be much appreciated.
String queryName = "doSomethingQuery";
SessionFactory factory = new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();
session = factory.openSession();
Transaction tx = session.beginTransaction();
Query query = session.getNamedQuery(queryName);
int rows = query.executeUpdate();
tx.commit();
session.flush();
session.close();
|
|