Thanks for the feedback, again, Juergen - I really appreciate it.
There is actually one other problem - if I "commit" the transaction via spring, in addition to getting the spring warning about "Could not reset JDBC connection of Hibernate session", but I also get an error from hibernate:
Code:
DEBUG|10:15:28.128|org.springframework.orm.hibernate.SessionFactoryUtils|Closing Hibernate session
DEBUG|10:15:28.128|net.sf.hibernate.impl.SessionImpl|closing session
DEBUG|10:15:28.128|net.sf.hibernate.impl.SessionImpl|disconnecting session
DEBUG|10:15:28.128|net.sf.hibernate.util.JDBCExceptionReporter|SQL Exception
java.sql.SQLException: The transaction is no longer active - status: 'Committed'. No further JDBC access is al
lowed within this transaction.
at weblogic.jdbc.wrapper.JTSConnection.checkIfRolledBack(JTSConnection.java:118)
at weblogic.jdbc.wrapper.JTSConnection.checkConnection(JTSConnection.java:127)
at weblogic.jdbc.wrapper.Connection.preInvocationHandler(Connection.java:67)
at weblogic.jdbc.wrapper.JTSConnection_oracle_jdbc_driver_OracleConnection.getWarnings(Unknown Source)
at net.sf.hibernate.impl.BatcherImpl.closeConnection(BatcherImpl.java:272)
at net.sf.hibernate.impl.SessionImpl.disconnect(SessionImpl.java:3198)
at net.sf.hibernate.impl.SessionImpl.close(SessionImpl.java:547)
at org.springframework.orm.hibernate.SessionFactoryUtils.closeSessionIfNecessary(SessionFactoryUtils.j
ava:181)
at org.springframework.orm.hibernate.HibernateTransactionManager.cleanupAfterCompletion(HibernateTrans
actionManager.java:363)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformT
ransactionManager.java:178)
at com.benefitpoint.cmp.data.AbstractDataManager.commitTransaction(AbstractDataManager.java:140)
at jsp_servlet._temp.__census_edit._jspService(__census_edit.java:238)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1053)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:431)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.jav
a:6310)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3622)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2569)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
WARN |10:15:28.128|net.sf.hibernate.util.JDBCExceptionReporter|SQL Error: 0, SQLState: null
ERROR|10:15:28.128|net.sf.hibernate.util.JDBCExceptionReporter|The transaction is no longer active - status: '
Committed'. No further JDBC access is allowed within this transaction.
ERROR|10:15:28.128|net.sf.hibernate.util.JDBCExceptionReporter|Cannot close connection
java.sql.SQLException: The transaction is no longer active - status: 'Committed'. No further JDBC access is al
lowed within this transaction.
So, what I've done is create a *new* spring TransactionManager, which is the same as HibernateTransactionManager, except that:
- doBegin() does NOT perform
Code:
txObject.getSessionHolder().setTransaction(session.beginTransaction());
when a JTA transaction does not currently exist
- doCommit() never executes
Code:
txObject.getSessionHolder().getTransaction().commit();
(since the only time a transaction will be used is when a JTA already exists, in which case it is commited by container.
I'm basically trying to emulate a transaction "SUPPORTED" configuration, where JTA will be used ONLY when an existing transaction is already active. I'm not sure if there is a better way to get hibernate (2.1, btw) to behave this way.
any thoughts?
thanks
tyson
This allows hibernate Session and JTA to take care of all transaction begin/commits, and uses existing