Hibernate version:
3.1 using MyEclipse Hibernate integration (to create SessionFactory's, HBM's, etc)
Code between sessionFactory.openSession() and session.close():
Code:
List <BMWIndices>newList = new ArrayList<BMWIndices>();
Session session = null;
try {
session = BankRatesSessionFactory.getSession();
for (Object o : session.getNamedQuery("GetBMWIndicesByTerm")
.setParameter(0, term).list())
newList.add((BMWIndices)o);
session.clear();
} // try
catch (HibernateException he) {
he.printStackTrace();
throw he;
} // catch
finally {
try {
BankRatesSessionFactory.closeSession();
} // try
catch (Exception exp) {
exp.printStackTrace();
} // catch
} // finally
return newList;
Name and version of the database you are using:
SQL Server 2005
We are experiencing an issue with the way hibernate is setup in our application (if it's a setup issue, really not sure). Any time a query is run using the above code sample, there remains an open hibernate process on SQL Server with 1 open transaction in a sleeping status. It is never cleaned up, we have to manually kill it because it seems to have locks on certain tables/fields such that our nightly jobs are delayed waiting for those locks to be removed. The last T-SQL command given by SQL Server for this process is "set implicit_transactions on".
Our application spans 3 databases, and as each one is queried, a process shows up in SQL Server for each of the databases that seem to persist indefinitely. We really need a solution that will clear those up so that any data loads/updates we do at night can process through without waiting for those processes to be killed due to the locks.
Thanks.