Hi ,
I get this error cannot create transaction context - infrequently. Not sure when it works and why.
Hibernate version:
I am using hibernate 3.0
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Apr 24, 2008 4:55:55 PM by Hibernate Tools 3.2.0.b9 -->
<hibernate-mapping>
<class name="com.t8.DAL.hibBeans.OriginalTransactionDetails" table="OriginalTransactionDetails" schema="dbo" catalog="SwiftWire_new">
<id name="transRefNum" type="string">
<column name="transRefNum" length="16" />
<generator class="assigned" />
</id>
<property name="debitAmount" type="big_decimal">
<column name="DebitAmount" precision="18" />
</property>
<property name="debitCurrency" type="string">
<column name="DebitCurrency" length="3" />
</property>
<property name="transactionDate" type="timestamp">
<column name="TransactionDate" length="23" not-null="true" />
</property>
<property name="debitValueDate" type="timestamp">
<column name="DebitValueDate" length="23" />
</property>
<property name="ourRef" type="string">
<column name="OurRef" length="50" />
</property>
<property name="creditAmount" type="big_decimal">
<column name="CreditAmount" precision="18" />
</property>
<property name="creditCurrency" type="string">
<column name="CreditCurrency" length="3" />
</property>
<property name="creditDate" type="timestamp">
<column name="CreditDate" length="23" />
</property>
<property name="creditValueDate" type="timestamp">
<column name="CreditValueDate" length="23" />
</property>
<property name="counterPartyRef" type="string">
<column name="CounterPartyRef" length="50" />
</property>
<property name="forexRate" type="big_decimal">
<column name="ForexRate" precision="18" not-null="false" />
</property>
<property name="postedAmount" type="big_decimal">
<column name="PostedAmount" precision="18" />
</property>
<property name="beneficiaryRef" type="string">
<column name="BeneficiaryRef" length="50" />
</property>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
BUTransaction buTransaction = new BUTransaction();
OriginalTransactionDetails origTransDet = buTransaction.getTransactions(mtTransRefFieldNo, transRefNum);
OriginalTransactionDetailsHome origTDHome = new OriginalTransactionDetailsHome();
origTDHome.attachDirty(origTransDet);
Full stack trace of any exception that occurs:
org.hibernate.HibernateException: clear is not valid without active transaction
org.hibernate.HibernateException: clear is not valid without active transaction
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
at $Proxy3.clear(Unknown Source)
at com.t8.DAL.OriginalTransactionDetailsHome.attachDirty(OriginalTransactionDetailsHome.java:61)
at com.t8.BAL.BUCase.saveCaseDetails(BUCase.java:86)
at com.t8.struts.action.UnableToApplyAction.saveTrans(UnableToApplyAction.java:202)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)
at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:619)
UnableToApplyAction - cannot create transaction context
org.hibernate.HibernateException: clear is not valid without active transaction
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
at $Proxy3.clear(Unknown Source)
at com.t8.DAL.OriginalTransactionDetailsHome.attachDirty(OriginalTransactionDetailsHome.java:61)
at com.t8.BAL.BUCase.saveCaseDetails(BUCase.java:86)
at com.t8.struts.action.UnableToApplyAction.saveTrans(UnableToApplyAction.java:202)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:269)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)
at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:619)
Name and version of the database you are using:
SQL Server 2005
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Apr 24, 2008 4:55:55 PM by Hibernate Tools 3.2.0.b9 -->
<hibernate-mapping>
<class name="com.t8.DAL.hibBeans.OriginalTransactionDetails" table="OriginalTransactionDetails" schema="dbo" catalog="SwiftWire_new">
<id name="transRefNum" type="string">
<column name="transRefNum" length="16" />
<generator class="assigned" />
</id>
<property name="debitAmount" type="big_decimal">
<column name="DebitAmount" precision="18" />
</property>
<property name="debitCurrency" type="string">
<column name="DebitCurrency" length="3" />
</property>
<property name="transactionDate" type="timestamp">
<column name="TransactionDate" length="23" not-null="true" />
</property>
<property name="debitValueDate" type="timestamp">
<column name="DebitValueDate" length="23" />
</property>
<property name="ourRef" type="string">
<column name="OurRef" length="50" />
</property>
<property name="creditAmount" type="big_decimal">
<column name="CreditAmount" precision="18" />
</property>
<property name="creditCurrency" type="string">
<column name="CreditCurrency" length="3" />
</property>
<property name="creditDate" type="timestamp">
<column name="CreditDate" length="23" />
</property>
<property name="creditValueDate" type="timestamp">
<column name="CreditValueDate" length="23" />
</property>
<property name="counterPartyRef" type="string">
<column name="CounterPartyRef" length="50" />
</property>
<property name="forexRate" type="big_decimal">
<column name="ForexRate" precision="18" not-null="false" />
</property>
<property name="postedAmount" type="big_decimal">
<column name="PostedAmount" precision="18" />
</property>
<property name="beneficiaryRef" type="string">
<column name="BeneficiaryRef" length="50" />
</property>
</class>
</hibernate-mapping>
Thanks in advance
|