Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
2.1.7
Mapping documents:
there are about 8-9 of them , i can send those if needed
Code between sessionFactory.openSession() and session.close():
UserTransaction jtaTransaction = (UserTransaction)
ServiceLocator.getInstance()
.lookup(ServiceLocator.USER_TRANSACTION);
Transaction transaction = null;
try{
jtaTransaction.begin();
transaction = SessionManager.currentSession().beginTransaction();
// dao code
transaction.commit();
jtaTransaction.commit();
}catch(Exception e){
transaction.rollback();
jtaTransaction.rollback();
throw e;
}finally{
SessionManager.closeSession();
}
Full stack trace of any exception that occurs:
could not register synchronization with JTA TransactionManager
net.sf.hibernate.TransactionException: could not register synchronization with JTA TransactionManager
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3357)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3321)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:66)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:779)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:265)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1553)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1530)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1526)
at scratch.BasicTasks.loadCompanyByName(BasicTasks.java:159)
at persistence.dataaccess.CompanyDataDAOTest.testInitializeCategories(CompanyDataDAOTest.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at junit.framework.TestCase.runTest(TestCase.java:154)
Name and version of the database you are using:
MySQL 4.1
The generated SQL (show_sql=true):
not relevant
Debug level Hibernate log excerpt:
intermittently i keep getting this problem while running my unit test cases.
As you can see i am using UserTransaction in JBoss 4.0.1
The SessionManager class is the one i picked up from Hibernate site for maintaining a session per thread (here per http request).
The hibernate is not deployed as a jboss service , i am packaging all the relevant jars with my ear package.
any help would be great .
thanks.
manu