Context: Hibernate 2.1.2, JBoss 3.2.3
I'm getting this error
Code:
[net.sf.hibernate.engine.CacheSynchronization] transaction before completion callback
[org.jboss.resource.connectionmanager.CachedConnectionManager] Closing a connection for you.
Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@db95a1
java.lang.Exception: STACKTRACE
at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:282)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:506)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:814)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:122)
at net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:56)
at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:278)
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3264)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3244)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:61)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:524)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)
at net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:906)
I'm using the same ThreadLocalSession code from this
wiki item. The code below is extracted from a Session Bean method with CMT, transaction=required.
Code:
---o<--- code snipped for brevity ---
try {
session = HibernateSession.currentSession();
tx = session.beginTransaction();
// do some session.save here ...
session.flush();
} catch(HibernateException he) {
if (session.isConnected()) {
try {
if (!tx.wasRolledBack())
tx.rollback();
} catch (HibernateException he2) {
throw new EJBException(he);
}
}
throw new EJBException(he);
} finally {
HibernateSession.closeSession();
}
What am I doing wrong ? Thanks a lot.
Alistair[/code]