I am calling a Sybase stored proc (sp) that creates a temp table as part of its code. This sp cannot be called inside a transaction because it cannot rollback the temp table operations. Note: "dll in tran" is not an option in prod.
When I try to run the code below I get the following exception;
Quote:
org.hibernate.HibernateException: getNamedQuery is not valid without active transaction
Note: the code below works perfectly when I call a replacement sp without the temp table stuff (and uncomment the transaction begin and commit)
Code:
public List getCompanies(String orgId, String userId) {
List results = null;
Session session = HibernateUtil.getCurrrentSession();
//session.beginTransaction();
results = session.getNamedQuery("getCompanyListSP")
.setParameter("orgId",orgId)
.setParameter("userId",userId)
.list();
//session.getTransaction().commit();
session.close();
...
return results;
}
I also have
<property name="hibernate.connection.autocommit">true</property> set in hibernate.config.xml
Any ideas would be greatly appreciated.