You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Dinkar Rao (JIRA)" <ji...@apache.org> on 2008/10/30 09:15:44 UTC

[jira] Commented: (OPENJPA-749) Re insert record into DB updating Entity while global transaction enabled.

    [ https://issues.apache.org/jira/browse/OPENJPA-749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12643778#action_12643778 ] 

Dinkar Rao commented on OPENJPA-749:
------------------------------------

I've been able to reproduce the problem in a scenario very similar to the one mentioned in this issue, albeit in a JSE setup. The fix submitted for OPENJPA-755 also fixes this problem in my scenario.  The test I have for this issue is apart from the one submitted for OPENJPA-755.

Thanks,
Dinkar

> Re insert record into DB updating Entity while global transaction enabled.
> --------------------------------------------------------------------------
>
>                 Key: OPENJPA-749
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-749
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.2.0
>         Environment: WPS6.1, DB2 9.0, OpenJPA 1.2.0, JDK 5 (IBM JVM)
>            Reporter: Lu HongJin
>            Priority: Critical
>
> 1. My env is : WPS6.1, DB2 9.0, OpenJPA 1.2.0
> 2. The followed is my persistence.xml configuration file:
> <persistence-unit name="derby.ojpa">
>         <provider>
>                   org.apache.openjpa.persistence.PersistenceProviderImpl
>             </provider>
>             <jta-data-source>jdbc/jpa</jta-data-source>
>             <mapping-file>orm.xml</mapping-file>
>             <properties>
>                   <property name="openjpa.TransactionMode" value="managed"
> />
>                   <property name="openjpa.ConnectionFactoryMode" value=
> "managed"/>
>                   <property name="openjpa.jdbc.DBDictionary" value="db2"/>
>                   <property name="openjpa.jdbc.EagerFetchMode" value="join"
> ></property>
>                   <property name="openjpa.InverseManager" value="true"/>
>                   <property name="openjpa.RetainState" value="true"/>
>                   <property name="openjpa.AutoDetach" value="nontx-read"/>
>                   <property name="openjpa.NontransactionalRead" value=
> "false"/>
>                   <property name="openjpa.NontransactionalWrite" value=
> "false"/>
>                   <property name="openjpa.ConnectionRetainMode" value=
> "transaction"/>
>             </properties>
>     </persistence-unit>
> 3. I enable global transaction of SCA component , make sure tx is started,
> and invokes several DAO operations in one of the SCA component operation
> named "updateCaseStatus".
> such as CaseMgmtImpl SCA component sequentially invokes DAO operations
>       CaseStatus cStatus = statusDAO.findByCaseStatusPK(caseeStatus);
>       Casee casee = caseDAO.findByCaseePKWithRef(caseeId);
>       casee.setBusinessStatus(cStatus);
>       caseDAO.updateCasee(casee);
> In caseDAO.findByCaseePKWithRef :
>       em = emf.createEntityManager();
>       em.joinTransaction();
>       result = (Casee)em.find(Casee.class, caseID);
>       em.close();
> In statusDAO.findByCaseStatusPK :
>       em = emf.createEntityManager();
>       em.joinTransaction();
>       result = (CaseStatus)em.find(CaseStatus.class, statusCode);
>       em.close();
> In caseDAO.updateCasee :
>       em = emf.createEntityManager();
>       em.joinTransaction();
>       Casee mergedcasee = em.merge(casee);
>       em.flush();
>       em.close();
> 4. Then at the end of the sca component updateCaseStatus method, such
> errors throwed.
> com.ibm.sbs.cci.dao.DAOException: <openjpa-1.2.0-r422266:683325 fatal
> general error> org.apache.openjpa.persistence.PersistenceException: DB2 SQL
> error: SQLCODE: -803, SQLSTATE: 23505, SQLERRMC: 1;DB2ADMIN.CASEESQLCA
> OUTPUT[Errp=SQLDMISR, Errd=-2146893819, 5, 0, 0, -957, 0]
> DB2 SQL error: SQLCODE: -803, SQLSTATE: 23505, SQLERRMC: 1;DB2ADMIN.CASEE
> FailedObject: prepstmnt 315232970 INSERT INTO DB2ADMIN.CASEE (CASEID,
> CREATIONTIME, EFFECTIVEDATE, ENDDATE, EXPIRYDATE,
> CASESTATUS_BUSINESSSTATUS, CASETYPE_CASETYPE) VALUES (?, ?, ?, ?, ?, ?, ?)
> [org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement]
>       at com.ibm.sbs.cci.dao.AbstractCaseeDAO.updateCasee(
> AbstractCaseeDAO.java:104)
>       at com.ibm.sbs.cci.CaseMgmtImpl.updateCaseStatus(
> CaseMgmtImpl.java:129)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:79)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:618)
>       at com.ibm.ws.sca.internal.java.handler.JavaReflectionAdapter$2.run(
> JavaReflectionAdapter.java:152)
>       at java.security.AccessController.doPrivileged(
> AccessController.java:197)
>       at com.ibm.ws.sca.internal.java.handler.JavaReflectionAdapter.invoke(
> JavaReflectionAdapter.java:149)
>       at
> com.ibm.ws.sca.internal.java.handler.JavaImplementationHandler.invokeSync(
> JavaImplementationHandler.java:447)
>       at
> com.ibm.ws.sca.internal.java.handler.JavaImplementationHandler.processMessage(
> JavaImplementationHandler.java:195)
>       at
> com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessageWithPCI(
> MessageDispatcherImpl.java:714)
>       at
> com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessage(
> MessageDispatcherImpl.java:1166)
>       at com.ibm.ws.sca.internal.message.impl.ManagedMessageImpl.process(
> ManagedMessageImpl.java:821)
>       at
> com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.processUOWMessage(
> ModuleSessionBean.java:338)
>       at
> com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.transactionRequiredActivitySessionNotSupported(
> ModuleSessionBean.java:311)
>       at
> com.ibm.wsspi.sca.ejb.module.EJSLocalStatelessModule_43132892.transactionRequiredActivitySessionNotSupported(
> EJSLocalStatelessModule_43132892.java:233)
>       at
> com.ibm.ws.sca.internal.uow.handler.UOWStrategyImpl.transactionGlobalActivitySessionFalse(
> UOWStrategyImpl.java:311)
>       at com.ibm.ws.sca.internal.uow.handler.JoinUOWHandler.processMessage(
> JoinUOWHandler.java:165)
>       at
> com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessageWithPCI(
> MessageDispatcherImpl.java:725)
>       at
> com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessage(
> MessageDispatcherImpl.java:1166)
>       at com.ibm.ws.sca.internal.message.impl.ManagedMessageImpl.process(
> ManagedMessageImpl.java:812)
>       at
> com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.processMessage(
> ModuleSessionBean.java:149)
>       at
> com.ibm.wsspi.sca.ejb.module.EJSLocalStatelessModule_43132892.processMessage(
> EJSLocalStatelessModule_43132892.java:97)
>       at
> com.ibm.wbit.comptest.controller.invocation.impl.AdhocInvoker.processMessage(Unknown
>  Source)
>       at
> com.ibm.wbit.comptest.controller.invocation.impl.Invoker.managedInvoke(Unknown
>  Source)
>       at
> com.ibm.wbit.comptest.controller.invocation.impl.Invoker.invoke(Unknown
> Source)
>       at
> com.ibm.wbit.comptest.controller.invocation.impl.BaseInvocationHandler.invoke(Unknown
>  Source)
>       at
> com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager.doInvoke(Unknown
>  Source)
>       at
> com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager$1.run(Unknown
>  Source)
>       at java.security.AccessController.doPrivileged(
> AccessController.java:219)
>       at javax.security.auth.Subject.doAs(Subject.java:495)
>       at com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:118)
>       at
> com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager.invoke(Unknown
>  Source)
>       at
> com.ibm.wbit.comptest.controller.command.impl.BaseCommandHandler.doCommand(Unknown
>  Source)
>       at
> com.ibm.wbit.comptest.controller.command.impl.CommandProcessor.doCommand(Unknown
>  Source)
>       at
> com.ibm.wbit.comptest.controller.command.impl.CommandProcessor.doCommand(Unknown
>  Source)
>       at com.ibm.wbit.comptest.servlet.TestControllerServlet.process(
> TestControllerServlet.java:76)
>       at com.ibm.wbit.comptest.servlet.TestControllerServlet.doPost(
> TestControllerServlet.java:51)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>       at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(
> ServletWrapper.java:995)
>       at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(
> ServletWrapper.java:501)
>       at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(
> ServletWrapper.java:464)
>       at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(
> CacheServletWrapper.java:90)
>       at com.ibm.ws.webcontainer.WebContainer.handleRequest(
> WebContainer.java:744)
>       at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(
> WebContainer.java:1455)
>       at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(
> WCChannelLink.java:113)
>       at
> com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(
> HttpInboundLink.java:454)
>       at
> com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(
> HttpInboundLink.java:383)
>       at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(
> HttpInboundLink.java:263)
>       at
> com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(
> NewConnectionInitialReadCallback.java:214)
>       at
> com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(
> NewConnectionInitialReadCallback.java:113)
>       at
> com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(
> AioReadCompletionListener.java:165)
>       at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(
> AbstractAsyncFuture.java:217)
>       at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(
> AsyncChannelFuture.java:161)
>       at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
>       at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
>       at com.ibm.io.async.ResultHandler.runEventProcessingLoop(
> ResultHandler.java:743)
>       at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
>       at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
> Caused by: <openjpa-1.2.0-r422266:683325 fatal general error>
> org.apache.openjpa.persistence.PersistenceException: DB2 SQL error:
> SQLCODE: -803, SQLSTATE: 23505, SQLERRMC: 1;DB2ADMIN.CASEESQLCA
> OUTPUT[Errp=SQLDMISR, Errd=-2146893819, 5, 0, 0, -957, 0]
> DB2 SQL error: SQLCODE: -803, SQLSTATE: 23505, SQLERRMC: 1;DB2ADMIN.CASEE
> FailedObject: prepstmnt 315232970 INSERT INTO DB2ADMIN.CASEE (CASEID,
> CREATIONTIME, EFFECTIVEDATE, ENDDATE, EXPIRYDATE,
> CASESTATUS_BUSINESSSTATUS, CASETYPE_CASETYPE) VALUES (?, ?, ?, ?, ?, ?, ?)
> [org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement]
>       at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(
> DBDictionary.java:4238)
>       at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(
> DBDictionary.java:4203)
>       at org.apache.openjpa.jdbc.sql.DB2Dictionary.newStoreException(
> DB2Dictionary.java:503)
>       at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(
> SQLExceptions.java:102)
>       at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(
> SQLExceptions.java:72)
>       at
> org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushBatch(
> BatchingPreparedStatementManagerImpl.java:195)
>       at org.apache.openjpa.jdbc.kernel.MyUpdateManager.flush(
> MyUpdateManager.java:357)
>       at org.apache.openjpa.jdbc.kernel.MyUpdateManager.flush(
> MyUpdateManager.java:77)
>       at org.apache.openjpa.jdbc.kernel.MyUpdateManager.flush(
> MyUpdateManager.java:60)
>       at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(
> JDBCStoreManager.java:655)
>       at org.apache.openjpa.kernel.DelegatingStoreManager.flush(
> DelegatingStoreManager.java:130)
>       at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2010)
>       at org.apache.openjpa.kernel.BrokerImpl.flushSafe(
> BrokerImpl.java:1908)
>       at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1679)
>       at org.apache.openjpa.kernel.DelegatingBroker.flush(
> DelegatingBroker.java:989)
>       at org.apache.openjpa.persistence.EntityManagerImpl.flush(
> EntityManagerImpl.java:592)
>       at com.ibm.sbs.cci.dao.AbstractCaseeDAO.updateCasee(
> AbstractCaseeDAO.java:98)
>       ... 60 more
> Caused by: com.ibm.websphere.ce.cm.DuplicateKeyException: DB2 SQL error:
> SQLCODE: -803, SQLSTATE: 23505, SQLERRMC: 1;DB2ADMIN.CASEE
>       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>       at sun.reflect.NativeConstructorAccessorImpl.newInstance(
> NativeConstructorAccessorImpl.java:67)
>       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
> DelegatingConstructorAccessorImpl.java:45)
>       at java.lang.reflect.Constructor.newInstance(Constructor.java:522)
>       at
> com.ibm.websphere.rsadapter.GenericDataStoreHelper.mapExceptionHelper(
> GenericDataStoreHelper.java:523)
>       at com.ibm.websphere.rsadapter.GenericDataStoreHelper.mapException(
> GenericDataStoreHelper.java:578)
>       at com.ibm.ws.rsadapter.jdbc.WSJdbcUtil.mapException(
> WSJdbcUtil.java:903)
>       at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeUpdate(
> WSJdbcPreparedStatement.java:626)
>       at
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate(
> DelegatingPreparedStatement.java:269)
>       at
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeUpdate(
> LoggingConnectionDecorator.java:864)
>       at
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate(
> DelegatingPreparedStatement.java:269)
>       at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeUpdate(
> JDBCStoreManager.java:1504)
>       at
> org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.executeUpdate(
> PreparedStatementManagerImpl.java:151)
>       at
> org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushSingleRow(
> BatchingPreparedStatementManagerImpl.java:217)
>       at
> org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushBatch(
> BatchingPreparedStatementManagerImpl.java:156)
>       ... 71 more
> [08-10-15 16:51:08:718 CST] 00000074 RegisteredSyn E   WTRN0074E: 从
> before_completion 同步操作捕获异常:<openjpa-1.2.0-r422266:683325 nonfatal
> user error> org.apache.openjpa.persistence.InvalidStateException:
> Encountered unmanaged object in persistent field
> "com.ibm.sbs.cci.pojo.Casee.businessStatus" during flush.  However, this
> field does not allow cascade persist. Set the cascade attribute for this
> field to CascadeType.PERSIST or CascadeType.ALL (JPA annotations) or
> "persist" or "all" (JPA orm.xml), or enable cascade-persist globally, or
> manually persist the related field value prior to flushing. You cannot
> flush unmanaged objects or graphs that have persistent associations to
> unmanaged objects.
> FailedObject: com.ibm.sbs.cci.pojo.CaseStatus-APPROVED
>       at org.apache.openjpa.kernel.SingleFieldManager.preFlushPC(
> SingleFieldManager.java:753)
>       at org.apache.openjpa.kernel.SingleFieldManager.preFlush(
> SingleFieldManager.java:594)
>       at org.apache.openjpa.kernel.SingleFieldManager.preFlush(
> SingleFieldManager.java:562)
>       at org.apache.openjpa.kernel.SingleFieldManager.preFlush(
> SingleFieldManager.java:478)
>       at org.apache.openjpa.kernel.StateManagerImpl.preFlush(
> StateManagerImpl.java:2828)
>       at org.apache.openjpa.kernel.PDirtyState.beforeFlush(
> PDirtyState.java:37)
>       at org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(
> StateManagerImpl.java:959)
>       at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1948)
>       at org.apache.openjpa.kernel.BrokerImpl.flushSafe(
> BrokerImpl.java:1908)
>       at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(
> BrokerImpl.java:1826)
>       at
> org.apache.openjpa.ee.WASManagedRuntime$WASSynchronization.beforeCompletion(
> WASManagedRuntime.java:304)
>       at
> com.ibm.ws.jtaextensions.SynchronizationCallbackWrapper.beforeCompletion(
> SynchronizationCallbackWrapper.java:65)
>       at com.ibm.ws.Transaction.JTA.RegisteredSyncs.distributeBefore(
> RegisteredSyncs.java:242)
>       at com.ibm.ws.Transaction.JTA.TransactionImpl.prePrepare(
> TransactionImpl.java:2398)
>       at com.ibm.ws.Transaction.JTA.TransactionImpl.stage1CommitProcessing(
> TransactionImpl.java:1631)
>       at com.ibm.ws.Transaction.JTA.TransactionImpl.processCommit(
> TransactionImpl.java:1602)
>       at com.ibm.ws.Transaction.JTA.TransactionImpl.commit(
> TransactionImpl.java:1537)
>       at com.ibm.ws.Transaction.JTA.TranManagerImpl.commit(
> TranManagerImpl.java:239)
>       at com.ibm.ws.Transaction.JTA.TranManagerSet.commit(
> TranManagerSet.java:163)
>       at com.ibm.ejs.csi.TranStrategy.commit(TranStrategy.java:756)
>       at com.ibm.ejs.csi.TranStrategy.postInvoke(TranStrategy.java:181)
>       at com.ibm.ejs.csi.TransactionControlImpl.postInvoke(
> TransactionControlImpl.java:581)
>       at com.ibm.ejs.container.EJSContainer.postInvoke(
> EJSContainer.java:3910)
>       at
> com.ibm.wsspi.sca.ejb.module.EJSLocalStatelessModule_43132892.transactionRequiredActivitySessionNotSupported(
> EJSLocalStatelessModule_43132892.java:244)
>       at
> com.ibm.ws.sca.internal.uow.handler.UOWStrategyImpl.transactionGlobalActivitySessionFalse(
> UOWStrategyImpl.java:311)
>       at com.ibm.ws.sca.internal.uow.handler.JoinUOWHandler.processMessage(
> JoinUOWHandler.java:165)
>       at
> com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessageWithPCI(
> MessageDispatcherImpl.java:725)
>       at
> com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessage(
> MessageDispatcherImpl.java:1166)
>       at com.ibm.ws.sca.internal.message.impl.ManagedMessageImpl.process(
> ManagedMessageImpl.java:812)
>       at
> com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.processMessage(
> ModuleSessionBean.java:149)
>       at
> com.ibm.wsspi.sca.ejb.module.EJSLocalStatelessModule_43132892.processMessage(
> EJSLocalStatelessModule_43132892.java:97)
>       at
> com.ibm.wbit.comptest.controller.invocation.impl.AdhocInvoker.processMessage(Unknown
>  Source)
>       at
> com.ibm.wbit.comptest.controller.invocation.impl.Invoker.managedInvoke(Unknown
>  Source)
>       at
> com.ibm.wbit.comptest.controller.invocation.impl.Invoker.invoke(Unknown
> Source)
>       at
> com.ibm.wbit.comptest.controller.invocation.impl.BaseInvocationHandler.invoke(Unknown
>  Source)
>       at
> com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager.doInvoke(Unknown
>  Source)
>       at
> com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager$1.run(Unknown
>  Source)
>       at java.security.AccessController.doPrivileged(
> AccessController.java:219)
>       at javax.security.auth.Subject.doAs(Subject.java:495)
>       at com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:118)
>       at
> com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager.invoke(Unknown
>  Source)
>       at
> com.ibm.wbit.comptest.controller.command.impl.BaseCommandHandler.doCommand(Unknown
>  Source)
>       at
> com.ibm.wbit.comptest.controller.command.impl.CommandProcessor.doCommand(Unknown
>  Source)
>       at
> com.ibm.wbit.comptest.controller.command.impl.CommandProcessor.doCommand(Unknown
>  Source)
>       at com.ibm.wbit.comptest.servlet.TestControllerServlet.process(
> TestControllerServlet.java:76)
>       at com.ibm.wbit.comptest.servlet.TestControllerServlet.doPost(
> TestControllerServlet.java:51)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>       at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(
> ServletWrapper.java:995)
>       at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(
> ServletWrapper.java:501)
>       at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(
> ServletWrapper.java:464)
>       at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(
> CacheServletWrapper.java:90)
>       at com.ibm.ws.webcontainer.WebContainer.handleRequest(
> WebContainer.java:744)
>       at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(
> WebContainer.java:1455)
>       at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(
> WCChannelLink.java:113)
>       at
> com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(
> HttpInboundLink.java:454)
>       at
> com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(
> HttpInboundLink.java:383)
>       at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(
> HttpInboundLink.java:263)
>       at
> com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(
> NewConnectionInitialReadCallback.java:214)
>       at
> com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(
> NewConnectionInitialReadCallback.java:113)
>       at
> com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(
> AioReadCompletionListener.java:165)
>       at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(
> AbstractAsyncFuture.java:217)
>       at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(
> AsyncChannelFuture.java:161)
>       at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
>       at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
>       at com.ibm.io.async.ResultHandler.runEventProcessingLoop(
> ResultHandler.java:743)
>       at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
>       at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
> 5. According to my analysis,
>       CaseStatus cStatus = statusDAO.findByCaseStatusPK(caseeStatus);   ---
> cStatus with StateManagerImpl & PNonTransState
>       Casee casee = caseDAO.findByCaseePKWithRef(caseeId);              ---
> casee with StateManagerImpl & PNonTransState
>       casee.setBusinessStatus(cStatus);                                 ---
> casee with StateManagerImpl & PDirtyState
>       caseDAO.updateCasee(casee);                                       ---
> in updateCasee method, casee(PDirtyTransState -> PNewState)
>       em = emf.createEntityManager();
>       em.joinTransaction();
>       Casee mergedcasee = em.merge(casee);                              ---
> casee with StateManagerImpl & PDirtyState
>                                                                         ---
> mergedcasee with StateManagerImpl & PNewState
>       em.flush();                                                       ---
> Here, a record would be inserted into DB
>       em.close();

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (OPENJPA-749) Re insert record into DB updating Entity while global transaction enabled.

Posted by Dinkar Rao <di...@gmail.com>.
Hi Hongjin,

How sure are you that the openjpa jar you built has the modified
SingleFieldManager classfile ? Since you are
patching/compiling/building/packaging the jar yourself, could you try
adding some informational messages to ensure that the updated
classfile from your updated jar is being picked up by the WPS ? How is
the openjpa jar being integrated into the portal server ?

Thanks,
Dinkar

2008/10/30 Hong Jin Lu <lu...@cn.ibm.com>:
> Should I just update the enhanced java class, or should I use a whole build
> on OpenJPA?
> I tried it while just updating the enhanced java class in OpenJPA 1.2.0, the
> error remains however.
> Johnny Lu (鲁红金 / Hongjin Lu)
> Developer, GCG Global Business Solution Centre (GBSC) - GBS Asset
> Management@CDL
> Tel: +86 10 82454718, TieLine: 9152244 x 4718, Fax: +86-10-8245-2904
> E-mail: luhongj@cn.ibm.com
> Address: 5/F DeShi Building, No. 9 ShangDi Dong Lu (East Road) Haidian
> District Beijing, 100094 P.R. China
>
> "Dinkar Rao (JIRA)" ---10/30/2008 04:16:14 PM--- [
> https://issues.apache.org/jira/browse/OPENJPA-749?page=com.atlassian.jira.plugin.system.issuet
>
>
> From:
> "Dinkar Rao (JIRA)" <ji...@apache.org>
> To:
> dev@openjpa.apache.org
> Date:
> 10/30/2008 04:16 PM
> Subject:
> [jira] Commented: (OPENJPA-749) Re insert record into DB updating Entity
> while global transaction enabled.
> ________________________________
>
>
>
>    [
> https://issues.apache.org/jira/browse/OPENJPA-749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12643778#action_12643778 ]
>
> Dinkar Rao commented on OPENJPA-749:
> ------------------------------------
>
> I've been able to reproduce the problem in a scenario very similar to the
> one mentioned in this issue, albeit in a JSE setup. The fix submitted for
> OPENJPA-755 also fixes this problem in my scenario.  The test I have for
> this issue is apart from the one submitted for OPENJPA-755.
>
> Thanks,
> Dinkar
>
>> Re insert record into DB updating Entity while global transaction enabled.
>> --------------------------------------------------------------------------
>>
>>                 Key: OPENJPA-749
>>                 URL: https://issues.apache.org/jira/browse/OPENJPA-749
>>             Project: OpenJPA
>>          Issue Type: Bug
>>          Components: jdbc
>>    Affects Versions: 1.2.0
>>         Environment: WPS6.1, DB2 9.0, OpenJPA 1.2.0, JDK 5 (IBM JVM)
>>            Reporter: Lu HongJin
>>            Priority: Critical
>>
>> 1. My env is : WPS6.1, DB2 9.0, OpenJPA 1.2.0
>> 2. The followed is my persistence.xml configuration file:
>> <persistence-unit name="derby.ojpa">
>>         <provider>
>>                   org.apache.openjpa.persistence.PersistenceProviderImpl
>>             </provider>
>>             <jta-data-source>jdbc/jpa</jta-data-source>
>>             <mapping-file>orm.xml</mapping-file>
>>             <properties>
>>                   <property name="openjpa.TransactionMode" value="managed"
>> />
>>                   <property name="openjpa.ConnectionFactoryMode" value=
>> "managed"/>
>>                   <property name="openjpa.jdbc.DBDictionary" value="db2"/>
>>                   <property name="openjpa.jdbc.EagerFetchMode"
>> value="join"
>> ></property>
>>                   <property name="openjpa.InverseManager" value="true"/>
>>                   <property name="openjpa.RetainState" value="true"/>
>>                   <property name="openjpa.AutoDetach" value="nontx-read"/>
>>                   <property name="openjpa.NontransactionalRead" value=
>> "false"/>
>>                   <property name="openjpa.NontransactionalWrite" value=
>> "false"/>
>>                   <property name="openjpa.ConnectionRetainMode" value=
>> "transaction"/>
>>             </properties>
>>     </persistence-unit>
>> 3. I enable global transaction of SCA component , make sure tx is started,
>> and invokes several DAO operations in one of the SCA component operation
>> named "updateCaseStatus".
>> such as CaseMgmtImpl SCA component sequentially invokes DAO operations
>>       CaseStatus cStatus = statusDAO.findByCaseStatusPK(caseeStatus);
>>       Casee casee = caseDAO.findByCaseePKWithRef(caseeId);
>>       casee.setBusinessStatus(cStatus);
>>       caseDAO.updateCasee(casee);
>> In caseDAO.findByCaseePKWithRef :
>>       em = emf.createEntityManager();
>>       em.joinTransaction();
>>       result = (Casee)em.find(Casee.class, caseID);
>>       em.close();
>> In statusDAO.findByCaseStatusPK :
>>       em = emf.createEntityManager();
>>       em.joinTransaction();
>>       result = (CaseStatus)em.find(CaseStatus.class, statusCode);
>>       em.close();
>> In caseDAO.updateCasee :
>>       em = emf.createEntityManager();
>>       em.joinTransaction();
>>       Casee mergedcasee = em.merge(casee);
>>       em.flush();
>>       em.close();
>> 4. Then at the end of the sca component updateCaseStatus method, such
>> errors throwed.
>> com.ibm.sbs.cci.dao.DAOException: <openjpa-1.2.0-r422266:683325 fatal
>> general error> org.apache.openjpa.persistence.PersistenceException: DB2
>> SQL
>> error: SQLCODE: -803, SQLSTATE: 23505, SQLERRMC: 1;DB2ADMIN.CASEESQLCA
>> OUTPUT[Errp=SQLDMISR, Errd=-2146893819, 5, 0, 0, -957, 0]
>> DB2 SQL error: SQLCODE: -803, SQLSTATE: 23505, SQLERRMC: 1;DB2ADMIN.CASEE
>> FailedObject: prepstmnt 315232970 INSERT INTO DB2ADMIN.CASEE (CASEID,
>> CREATIONTIME, EFFECTIVEDATE, ENDDATE, EXPIRYDATE,
>> CASESTATUS_BUSINESSSTATUS, CASETYPE_CASETYPE) VALUES (?, ?, ?, ?, ?, ?, ?)
>> [org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement]
>>       at com.ibm.sbs.cci.dao.AbstractCaseeDAO.updateCasee(
>> AbstractCaseeDAO.java:104)
>>       at com.ibm.sbs.cci.CaseMgmtImpl.updateCaseStatus(
>> CaseMgmtImpl.java:129)
>>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>       at sun.reflect.NativeMethodAccessorImpl.invoke(
>> NativeMethodAccessorImpl.java:79)
>>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:43)
>>       at java.lang.reflect.Method.invoke(Method.java:618)
>>       at com.ibm.ws.sca.internal.java.handler.JavaReflectionAdapter$2.run(
>> JavaReflectionAdapter.java:152)
>>       at java.security.AccessController.doPrivileged(
>> AccessController.java:197)
>>       at
>> com.ibm.ws.sca.internal.java.handler.JavaReflectionAdapter.invoke(
>> JavaReflectionAdapter.java:149)
>>       at
>> com.ibm.ws.sca.internal.java.handler.JavaImplementationHandler.invokeSync(
>> JavaImplementationHandler.java:447)
>>       at
>>
>> com.ibm.ws.sca.internal.java.handler.JavaImplementationHandler.processMessage(
>> JavaImplementationHandler.java:195)
>>       at
>>
>> com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessageWithPCI(
>> MessageDispatcherImpl.java:714)
>>       at
>> com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessage(
>> MessageDispatcherImpl.java:1166)
>>       at com.ibm.ws.sca.internal.message.impl.ManagedMessageImpl.process(
>> ManagedMessageImpl.java:821)
>>       at
>> com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.processUOWMessage(
>> ModuleSessionBean.java:338)
>>       at
>>
>> com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.transactionRequiredActivitySessionNotSupported(
>> ModuleSessionBean.java:311)
>>       at
>>
>> com.ibm.wsspi.sca.ejb.module.EJSLocalStatelessModule_43132892.transactionRequiredActivitySessionNotSupported(
>> EJSLocalStatelessModule_43132892.java:233)
>>       at
>>
>> com.ibm.ws.sca.internal.uow.handler.UOWStrategyImpl.transactionGlobalActivitySessionFalse(
>> UOWStrategyImpl.java:311)
>>       at
>> com.ibm.ws.sca.internal.uow.handler.JoinUOWHandler.processMessage(
>> JoinUOWHandler.java:165)
>>       at
>>
>> com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessageWithPCI(
>> MessageDispatcherImpl.java:725)
>>       at
>> com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessage(
>> MessageDispatcherImpl.java:1166)
>>       at com.ibm.ws.sca.internal.message.impl.ManagedMessageImpl.process(
>> ManagedMessageImpl.java:812)
>>       at
>> com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.processMessage(
>> ModuleSessionBean.java:149)
>>       at
>>
>> com.ibm.wsspi.sca.ejb.module.EJSLocalStatelessModule_43132892.processMessage(
>> EJSLocalStatelessModule_43132892.java:97)
>>       at
>>
>> com.ibm.wbit.comptest.controller.invocation.impl.AdhocInvoker.processMessage(Unknown
>>  Source)
>>       at
>>
>> com.ibm.wbit.comptest.controller.invocation.impl.Invoker.managedInvoke(Unknown
>>  Source)
>>       at
>> com.ibm.wbit.comptest.controller.invocation.impl.Invoker.invoke(Unknown
>> Source)
>>       at
>>
>> com.ibm.wbit.comptest.controller.invocation.impl.BaseInvocationHandler.invoke(Unknown
>>  Source)
>>       at
>>
>> com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager.doInvoke(Unknown
>>  Source)
>>       at
>>
>> com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager$1.run(Unknown
>>  Source)
>>       at java.security.AccessController.doPrivileged(
>> AccessController.java:219)
>>       at javax.security.auth.Subject.doAs(Subject.java:495)
>>       at
>> com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:118)
>>       at
>>
>> com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager.invoke(Unknown
>>  Source)
>>       at
>>
>> com.ibm.wbit.comptest.controller.command.impl.BaseCommandHandler.doCommand(Unknown
>>  Source)
>>       at
>>
>> com.ibm.wbit.comptest.controller.command.impl.CommandProcessor.doCommand(Unknown
>>  Source)
>>       at
>>
>> com.ibm.wbit.comptest.controller.command.impl.CommandProcessor.doCommand(Unknown
>>  Source)
>>       at com.ibm.wbit.comptest.servlet.TestControllerServlet.process(
>> TestControllerServlet.java:76)
>>       at com.ibm.wbit.comptest.servlet.TestControllerServlet.doPost(
>> TestControllerServlet.java:51)
>>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
>>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>>       at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(
>> ServletWrapper.java:995)
>>       at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(
>> ServletWrapper.java:501)
>>       at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(
>> ServletWrapper.java:464)
>>       at
>> com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(
>> CacheServletWrapper.java:90)
>>       at com.ibm.ws.webcontainer.WebContainer.handleRequest(
>> WebContainer.java:744)
>>       at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(
>> WebContainer.java:1455)
>>       at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(
>> WCChannelLink.java:113)
>>       at
>> com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(
>> HttpInboundLink.java:454)
>>       at
>> com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(
>> HttpInboundLink.java:383)
>>       at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(
>> HttpInboundLink.java:263)
>>       at
>>
>> com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(
>> NewConnectionInitialReadCallback.java:214)
>>       at
>> com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(
>> NewConnectionInitialReadCallback.java:113)
>>       at
>> com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(
>> AioReadCompletionListener.java:165)
>>       at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(
>> AbstractAsyncFuture.java:217)
>>       at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(
>> AsyncChannelFuture.java:161)
>>       at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
>>       at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
>>       at com.ibm.io.async.ResultHandler.runEventProcessingLoop(
>> ResultHandler.java:743)
>>       at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
>>       at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
>> Caused by: <openjpa-1.2.0-r422266:683325 fatal general error>
>> org.apache.openjpa.persistence.PersistenceException: DB2 SQL error:
>> SQLCODE: -803, SQLSTATE: 23505, SQLERRMC: 1;DB2ADMIN.CASEESQLCA
>> OUTPUT[Errp=SQLDMISR, Errd=-2146893819, 5, 0, 0, -957, 0]
>> DB2 SQL error: SQLCODE: -803, SQLSTATE: 23505, SQLERRMC: 1;DB2ADMIN.CASEE
>> FailedObject: prepstmnt 315232970 INSERT INTO DB2ADMIN.CASEE (CASEID,
>> CREATIONTIME, EFFECTIVEDATE, ENDDATE, EXPIRYDATE,
>> CASESTATUS_BUSINESSSTATUS, CASETYPE_CASETYPE) VALUES (?, ?, ?, ?, ?, ?, ?)
>> [org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement]
>>       at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(
>> DBDictionary.java:4238)
>>       at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(
>> DBDictionary.java:4203)
>>       at org.apache.openjpa.jdbc.sql.DB2Dictionary.newStoreException(
>> DB2Dictionary.java:503)
>>       at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(
>> SQLExceptions.java:102)
>>       at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(
>> SQLExceptions.java:72)
>>       at
>>
>> org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushBatch(
>> BatchingPreparedStatementManagerImpl.java:195)
>>       at org.apache.openjpa.jdbc.kernel.MyUpdateManager.flush(
>> MyUpdateManager.java:357)
>>       at org.apache.openjpa.jdbc.kernel.MyUpdateManager.flush(
>> MyUpdateManager.java:77)
>>       at org.apache.openjpa.jdbc.kernel.MyUpdateManager.flush(
>> MyUpdateManager.java:60)
>>       at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(
>> JDBCStoreManager.java:655)
>>       at org.apache.openjpa.kernel.DelegatingStoreManager.flush(
>> DelegatingStoreManager.java:130)
>>       at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2010)
>>       at org.apache.openjpa.kernel.BrokerImpl.flushSafe(
>> BrokerImpl.java:1908)
>>       at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1679)
>>       at org.apache.openjpa.kernel.DelegatingBroker.flush(
>> DelegatingBroker.java:989)
>>       at org.apache.openjpa.persistence.EntityManagerImpl.flush(
>> EntityManagerImpl.java:592)
>>       at com.ibm.sbs.cci.dao.AbstractCaseeDAO.updateCasee(
>> AbstractCaseeDAO.java:98)
>>       ... 60 more
>> Caused by: com.ibm.websphere.ce.cm.DuplicateKeyException: DB2 SQL error:
>> SQLCODE: -803, SQLSTATE: 23505, SQLERRMC: 1;DB2ADMIN.CASEE
>>       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>> Method)
>>       at sun.reflect.NativeConstructorAccessorImpl.newInstance(
>> NativeConstructorAccessorImpl.java:67)
>>       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
>> DelegatingConstructorAccessorImpl.java:45)
>>       at java.lang.reflect.Constructor.newInstance(Constructor.java:522)
>>       at
>> com.ibm.websphere.rsadapter.GenericDataStoreHelper.mapExceptionHelper(
>> GenericDataStoreHelper.java:523)
>>       at com.ibm.websphere.rsadapter.GenericDataStoreHelper.mapException(
>> GenericDataStoreHelper.java:578)
>>       at com.ibm.ws.rsadapter.jdbc.WSJdbcUtil.mapException(
>> WSJdbcUtil.java:903)
>>       at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeUpdate(
>> WSJdbcPreparedStatement.java:626)
>>       at
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate(
>> DelegatingPreparedStatement.java:269)
>>       at
>>
>> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeUpdate(
>> LoggingConnectionDecorator.java:864)
>>       at
>> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate(
>> DelegatingPreparedStatement.java:269)
>>       at
>>
>> org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeUpdate(
>> JDBCStoreManager.java:1504)
>>       at
>> org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.executeUpdate(
>> PreparedStatementManagerImpl.java:151)
>>       at
>>
>> org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushSingleRow(
>> BatchingPreparedStatementManagerImpl.java:217)
>>       at
>>
>> org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushBatch(
>> BatchingPreparedStatementManagerImpl.java:156)
>>       ... 71 more
>> [08-10-15 16:51:08:718 CST] 00000074 RegisteredSyn E   WTRN0074E: 从
>> before_completion 同步操作捕获异常:<openjpa-1.2.0-r422266:683325 nonfatal
>> user error> org.apache.openjpa.persistence.InvalidStateException:
>> Encountered unmanaged object in persistent field
>> "com.ibm.sbs.cci.pojo.Casee.businessStatus" during flush.  However, this
>> field does not allow cascade persist. Set the cascade attribute for this
>> field to CascadeType.PERSIST or CascadeType.ALL (JPA annotations) or
>> "persist" or "all" (JPA orm.xml), or enable cascade-persist globally, or
>> manually persist the related field value prior to flushing. You cannot
>> flush unmanaged objects or graphs that have persistent associations to
>> unmanaged objects.
>> FailedObject: com.ibm.sbs.cci.pojo.CaseStatus-APPROVED
>>       at org.apache.openjpa.kernel.SingleFieldManager.preFlushPC(
>> SingleFieldManager.java:753)
>>       at org.apache.openjpa.kernel.SingleFieldManager.preFlush(
>> SingleFieldManager.java:594)
>>       at org.apache.openjpa.kernel.SingleFieldManager.preFlush(
>> SingleFieldManager.java:562)
>>       at org.apache.openjpa.kernel.SingleFieldManager.preFlush(
>> SingleFieldManager.java:478)
>>       at org.apache.openjpa.kernel.StateManagerImpl.preFlush(
>> StateManagerImpl.java:2828)
>>       at org.apache.openjpa.kernel.PDirtyState.beforeFlush(
>> PDirtyState.java:37)
>>       at org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(
>> StateManagerImpl.java:959)
>>       at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1948)
>>       at org.apache.openjpa.kernel.BrokerImpl.flushSafe(
>> BrokerImpl.java:1908)
>>       at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(
>> BrokerImpl.java:1826)
>>       at
>>
>> org.apache.openjpa.ee.WASManagedRuntime$WASSynchronization.beforeCompletion(
>> WASManagedRuntime.java:304)
>>       at
>> com.ibm.ws.jtaextensions.SynchronizationCallbackWrapper.beforeCompletion(
>> SynchronizationCallbackWrapper.java:65)
>>       at com.ibm.ws.Transaction.JTA.RegisteredSyncs.distributeBefore(
>> RegisteredSyncs.java:242)
>>       at com.ibm.ws.Transaction.JTA.TransactionImpl.prePrepare(
>> TransactionImpl.java:2398)
>>       at
>> com.ibm.ws.Transaction.JTA.TransactionImpl.stage1CommitProcessing(
>> TransactionImpl.java:1631)
>>       at com.ibm.ws.Transaction.JTA.TransactionImpl.processCommit(
>> TransactionImpl.java:1602)
>>       at com.ibm.ws.Transaction.JTA.TransactionImpl.commit(
>> TransactionImpl.java:1537)
>>       at com.ibm.ws.Transaction.JTA.TranManagerImpl.commit(
>> TranManagerImpl.java:239)
>>       at com.ibm.ws.Transaction.JTA.TranManagerSet.commit(
>> TranManagerSet.java:163)
>>       at com.ibm.ejs.csi.TranStrategy.commit(TranStrategy.java:756)
>>       at com.ibm.ejs.csi.TranStrategy.postInvoke(TranStrategy.java:181)
>>       at com.ibm.ejs.csi.TransactionControlImpl.postInvoke(
>> TransactionControlImpl.java:581)
>>       at com.ibm.ejs.container.EJSContainer.postInvoke(
>> EJSContainer.java:3910)
>>       at
>>
>> com.ibm.wsspi.sca.ejb.module.EJSLocalStatelessModule_43132892.transactionRequiredActivitySessionNotSupported(
>> EJSLocalStatelessModule_43132892.java:244)
>>       at
>>
>> com.ibm.ws.sca.internal.uow.handler.UOWStrategyImpl.transactionGlobalActivitySessionFalse(
>> UOWStrategyImpl.java:311)
>>       at
>> com.ibm.ws.sca.internal.uow.handler.JoinUOWHandler.processMessage(
>> JoinUOWHandler.java:165)
>>       at
>>
>> com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessageWithPCI(
>> MessageDispatcherImpl.java:725)
>>       at
>> com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessage(
>> MessageDispatcherImpl.java:1166)
>>       at com.ibm.ws.sca.internal.message.impl.ManagedMessageImpl.process(
>> ManagedMessageImpl.java:812)
>>       at
>> com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.processMessage(
>> ModuleSessionBean.java:149)
>>       at
>>
>> com.ibm.wsspi.sca.ejb.module.EJSLocalStatelessModule_43132892.processMessage(
>> EJSLocalStatelessModule_43132892.java:97)
>>       at
>>
>> com.ibm.wbit.comptest.controller.invocation.impl.AdhocInvoker.processMessage(Unknown
>>  Source)
>>       at
>>
>> com.ibm.wbit.comptest.controller.invocation.impl.Invoker.managedInvoke(Unknown
>>  Source)
>>       at
>> com.ibm.wbit.comptest.controller.invocation.impl.Invoker.invoke(Unknown
>> Source)
>>       at
>>
>> com.ibm.wbit.comptest.controller.invocation.impl.BaseInvocationHandler.invoke(Unknown
>>  Source)
>>       at
>>
>> com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager.doInvoke(Unknown
>>  Source)
>>       at
>>
>> com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager$1.run(Unknown
>>  Source)
>>       at java.security.AccessController.doPrivileged(
>> AccessController.java:219)
>>       at javax.security.auth.Subject.doAs(Subject.java:495)
>>       at
>> com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:118)
>>       at
>>
>> com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager.invoke(Unknown
>>  Source)
>>       at
>>
>> com.ibm.wbit.comptest.controller.command.impl.BaseCommandHandler.doCommand(Unknown
>>  Source)
>>       at
>>
>> com.ibm.wbit.comptest.controller.command.impl.CommandProcessor.doCommand(Unknown
>>  Source)
>>       at
>>
>> com.ibm.wbit.comptest.controller.command.impl.CommandProcessor.doCommand(Unknown
>>  Source)
>>       at com.ibm.wbit.comptest.servlet.TestControllerServlet.process(
>> TestControllerServlet.java:76)
>>       at com.ibm.wbit.comptest.servlet.TestControllerServlet.doPost(
>> TestControllerServlet.java:51)
>>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
>>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>>       at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(
>> ServletWrapper.java:995)
>>       at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(
>> ServletWrapper.java:501)
>>       at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(
>> ServletWrapper.java:464)
>>       at
>> com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(
>> CacheServletWrapper.java:90)
>>       at com.ibm.ws.webcontainer.WebContainer.handleRequest(
>> WebContainer.java:744)
>>       at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(
>> WebContainer.java:1455)
>>       at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(
>> WCChannelLink.java:113)
>>       at
>> com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(
>> HttpInboundLink.java:454)
>>       at
>> com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(
>> HttpInboundLink.java:383)
>>       at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(
>> HttpInboundLink.java:263)
>>       at
>>
>> com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(
>> NewConnectionInitialReadCallback.java:214)
>>       at
>> com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(
>> NewConnectionInitialReadCallback.java:113)
>>       at
>> com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(
>> AioReadCompletionListener.java:165)
>>       at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(
>> AbstractAsyncFuture.java:217)
>>       at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(
>> AsyncChannelFuture.java:161)
>>       at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
>>       at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
>>       at com.ibm.io.async.ResultHandler.runEventProcessingLoop(
>> ResultHandler.java:743)
>>       at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
>>       at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
>> 5. According to my analysis,
>>       CaseStatus cStatus = statusDAO.findByCaseStatusPK(caseeStatus);
>> ---
>> cStatus with StateManagerImpl & PNonTransState
>>       Casee casee = caseDAO.findByCaseePKWithRef(caseeId);
>>  ---
>> casee with StateManagerImpl & PNonTransState
>>       casee.setBusinessStatus(cStatus);
>> ---
>> casee with StateManagerImpl & PDirtyState
>>       caseDAO.updateCasee(casee);
>> ---
>> in updateCasee method, casee(PDirtyTransState -> PNewState)
>>       em = emf.createEntityManager();
>>       em.joinTransaction();
>>       Casee mergedcasee = em.merge(casee);
>>  ---
>> casee with StateManagerImpl & PDirtyState
>>
>> ---
>> mergedcasee with StateManagerImpl & PNewState
>>       em.flush();
>> ---
>> Here, a record would be inserted into DB
>>       em.close();
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>
>
>

Re: [jira] Commented: (OPENJPA-749) Re insert record into DB updating Entity while global transaction enabled.

Posted by Hong Jin Lu <lu...@cn.ibm.com>.
Should I just update the enhanced java class, or should I use a whole build
on OpenJPA?
I tried it while just updating the enhanced java class in OpenJPA 1.2.0,
the error remains however.
Johnny Lu (鲁红金 / Hongjin Lu)
Developer, GCG Global Business Solution Centre (GBSC) - GBS Asset
Management@CDL
Tel: +86 10 82454718, TieLine: 9152244 x 4718, Fax: +86-10-8245-2904
E-mail: luhongj@cn.ibm.com
Address: 5/F DeShi Building, No. 9 ShangDi Dong Lu (East Road)  Haidian
District Beijing, 100094 P.R. China


|------------>
| From:      |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |"Dinkar Rao (JIRA)" <ji...@apache.org>                                                                                                             |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |dev@openjpa.apache.org                                                                                                                            |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |10/30/2008 04:16 PM                                                                                                                               |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |[jira] Commented: (OPENJPA-749) Re insert record into DB updating Entity while global transaction enabled.                                        |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|






    [
https://issues.apache.org/jira/browse/OPENJPA-749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12643778#action_12643778
 ]

Dinkar Rao commented on OPENJPA-749:
------------------------------------

I've been able to reproduce the problem in a scenario very similar to the
one mentioned in this issue, albeit in a JSE setup. The fix submitted for
OPENJPA-755 also fixes this problem in my scenario.  The test I have for
this issue is apart from the one submitted for OPENJPA-755.

Thanks,
Dinkar

> Re insert record into DB updating Entity while global transaction
enabled.
>
--------------------------------------------------------------------------
>
>                 Key: OPENJPA-749
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-749
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.2.0
>         Environment: WPS6.1, DB2 9.0, OpenJPA 1.2.0, JDK 5 (IBM JVM)
>            Reporter: Lu HongJin
>            Priority: Critical
>
> 1. My env is : WPS6.1, DB2 9.0, OpenJPA 1.2.0
> 2. The followed is my persistence.xml configuration file:
> <persistence-unit name="derby.ojpa">
>         <provider>
>                   org.apache.openjpa.persistence.PersistenceProviderImpl
>             </provider>
>             <jta-data-source>jdbc/jpa</jta-data-source>
>             <mapping-file>orm.xml</mapping-file>
>             <properties>
>                   <property name="openjpa.TransactionMode"
value="managed"
> />
>                   <property name="openjpa.ConnectionFactoryMode" value=
> "managed"/>
>                   <property name="openjpa.jdbc.DBDictionary"
value="db2"/>
>                   <property name="openjpa.jdbc.EagerFetchMode"
value="join"
> ></property>
>                   <property name="openjpa.InverseManager" value="true"/>
>                   <property name="openjpa.RetainState" value="true"/>
>                   <property name="openjpa.AutoDetach"
value="nontx-read"/>
>                   <property name="openjpa.NontransactionalRead" value=
> "false"/>
>                   <property name="openjpa.NontransactionalWrite" value=
> "false"/>
>                   <property name="openjpa.ConnectionRetainMode" value=
> "transaction"/>
>             </properties>
>     </persistence-unit>
> 3. I enable global transaction of SCA component , make sure tx is
started,
> and invokes several DAO operations in one of the SCA component operation
> named "updateCaseStatus".
> such as CaseMgmtImpl SCA component sequentially invokes DAO operations
>       CaseStatus cStatus = statusDAO.findByCaseStatusPK(caseeStatus);
>       Casee casee = caseDAO.findByCaseePKWithRef(caseeId);
>       casee.setBusinessStatus(cStatus);
>       caseDAO.updateCasee(casee);
> In caseDAO.findByCaseePKWithRef :
>       em = emf.createEntityManager();
>       em.joinTransaction();
>       result = (Casee)em.find(Casee.class, caseID);
>       em.close();
> In statusDAO.findByCaseStatusPK :
>       em = emf.createEntityManager();
>       em.joinTransaction();
>       result = (CaseStatus)em.find(CaseStatus.class, statusCode);
>       em.close();
> In caseDAO.updateCasee :
>       em = emf.createEntityManager();
>       em.joinTransaction();
>       Casee mergedcasee = em.merge(casee);
>       em.flush();
>       em.close();
> 4. Then at the end of the sca component updateCaseStatus method, such
> errors throwed.
> com.ibm.sbs.cci.dao.DAOException: <openjpa-1.2.0-r422266:683325 fatal
> general error> org.apache.openjpa.persistence.PersistenceException: DB2
SQL
> error: SQLCODE: -803, SQLSTATE: 23505, SQLERRMC: 1;DB2ADMIN.CASEESQLCA
> OUTPUT[Errp=SQLDMISR, Errd=-2146893819, 5, 0, 0, -957, 0]
> DB2 SQL error: SQLCODE: -803, SQLSTATE: 23505, SQLERRMC: 1;DB2ADMIN.CASEE
> FailedObject: prepstmnt 315232970 INSERT INTO DB2ADMIN.CASEE (CASEID,
> CREATIONTIME, EFFECTIVEDATE, ENDDATE, EXPIRYDATE,
> CASESTATUS_BUSINESSSTATUS, CASETYPE_CASETYPE) VALUES (?, ?, ?, ?, ?, ?,
?)
> [org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement]
>       at com.ibm.sbs.cci.dao.AbstractCaseeDAO.updateCasee(
> AbstractCaseeDAO.java:104)
>       at com.ibm.sbs.cci.CaseMgmtImpl.updateCaseStatus(
> CaseMgmtImpl.java:129)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:79)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:618)
>       at
com.ibm.ws.sca.internal.java.handler.JavaReflectionAdapter$2.run(
> JavaReflectionAdapter.java:152)
>       at java.security.AccessController.doPrivileged(
> AccessController.java:197)
>       at
com.ibm.ws.sca.internal.java.handler.JavaReflectionAdapter.invoke(
> JavaReflectionAdapter.java:149)
>       at
>
com.ibm.ws.sca.internal.java.handler.JavaImplementationHandler.invokeSync(
> JavaImplementationHandler.java:447)
>       at
>
com.ibm.ws.sca.internal.java.handler.JavaImplementationHandler.processMessage(

> JavaImplementationHandler.java:195)
>       at
>
com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessageWithPCI(

> MessageDispatcherImpl.java:714)
>       at
>
com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessage(
> MessageDispatcherImpl.java:1166)
>       at com.ibm.ws.sca.internal.message.impl.ManagedMessageImpl.process(
> ManagedMessageImpl.java:821)
>       at
> com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.processUOWMessage(
> ModuleSessionBean.java:338)
>       at
>
com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.transactionRequiredActivitySessionNotSupported(

> ModuleSessionBean.java:311)
>       at
>
com.ibm.wsspi.sca.ejb.module.EJSLocalStatelessModule_43132892.transactionRequiredActivitySessionNotSupported(

> EJSLocalStatelessModule_43132892.java:233)
>       at
>
com.ibm.ws.sca.internal.uow.handler.UOWStrategyImpl.transactionGlobalActivitySessionFalse(

> UOWStrategyImpl.java:311)
>       at
com.ibm.ws.sca.internal.uow.handler.JoinUOWHandler.processMessage(
> JoinUOWHandler.java:165)
>       at
>
com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessageWithPCI(

> MessageDispatcherImpl.java:725)
>       at
>
com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessage(
> MessageDispatcherImpl.java:1166)
>       at com.ibm.ws.sca.internal.message.impl.ManagedMessageImpl.process(
> ManagedMessageImpl.java:812)
>       at
> com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.processMessage(
> ModuleSessionBean.java:149)
>       at
>
com.ibm.wsspi.sca.ejb.module.EJSLocalStatelessModule_43132892.processMessage(

> EJSLocalStatelessModule_43132892.java:97)
>       at
>
com.ibm.wbit.comptest.controller.invocation.impl.AdhocInvoker.processMessage(Unknown

>  Source)
>       at
>
com.ibm.wbit.comptest.controller.invocation.impl.Invoker.managedInvoke(Unknown

>  Source)
>       at
> com.ibm.wbit.comptest.controller.invocation.impl.Invoker.invoke(Unknown
> Source)
>       at
>
com.ibm.wbit.comptest.controller.invocation.impl.BaseInvocationHandler.invoke(Unknown

>  Source)
>       at
>
com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager.doInvoke(Unknown

>  Source)
>       at
>
com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager$1.run(Unknown

>  Source)
>       at java.security.AccessController.doPrivileged(
> AccessController.java:219)
>       at javax.security.auth.Subject.doAs(Subject.java:495)
>       at
com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:118)
>       at
>
com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager.invoke(Unknown

>  Source)
>       at
>
com.ibm.wbit.comptest.controller.command.impl.BaseCommandHandler.doCommand(Unknown

>  Source)
>       at
>
com.ibm.wbit.comptest.controller.command.impl.CommandProcessor.doCommand(Unknown

>  Source)
>       at
>
com.ibm.wbit.comptest.controller.command.impl.CommandProcessor.doCommand(Unknown

>  Source)
>       at com.ibm.wbit.comptest.servlet.TestControllerServlet.process(
> TestControllerServlet.java:76)
>       at com.ibm.wbit.comptest.servlet.TestControllerServlet.doPost(
> TestControllerServlet.java:51)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>       at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(
> ServletWrapper.java:995)
>       at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(
> ServletWrapper.java:501)
>       at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(
> ServletWrapper.java:464)
>       at
com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(
> CacheServletWrapper.java:90)
>       at com.ibm.ws.webcontainer.WebContainer.handleRequest(
> WebContainer.java:744)
>       at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(
> WebContainer.java:1455)
>       at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(
> WCChannelLink.java:113)
>       at
>
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(
> HttpInboundLink.java:454)
>       at
>
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(
> HttpInboundLink.java:383)
>       at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(
> HttpInboundLink.java:263)
>       at
>
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(

> NewConnectionInitialReadCallback.java:214)
>       at
> com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(
> NewConnectionInitialReadCallback.java:113)
>       at
> com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(
> AioReadCompletionListener.java:165)
>       at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(
> AbstractAsyncFuture.java:217)
>       at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(
> AsyncChannelFuture.java:161)
>       at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
>       at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
>       at com.ibm.io.async.ResultHandler.runEventProcessingLoop(
> ResultHandler.java:743)
>       at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
>       at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
> Caused by: <openjpa-1.2.0-r422266:683325 fatal general error>
> org.apache.openjpa.persistence.PersistenceException: DB2 SQL error:
> SQLCODE: -803, SQLSTATE: 23505, SQLERRMC: 1;DB2ADMIN.CASEESQLCA
> OUTPUT[Errp=SQLDMISR, Errd=-2146893819, 5, 0, 0, -957, 0]
> DB2 SQL error: SQLCODE: -803, SQLSTATE: 23505, SQLERRMC: 1;DB2ADMIN.CASEE
> FailedObject: prepstmnt 315232970 INSERT INTO DB2ADMIN.CASEE (CASEID,
> CREATIONTIME, EFFECTIVEDATE, ENDDATE, EXPIRYDATE,
> CASESTATUS_BUSINESSSTATUS, CASETYPE_CASETYPE) VALUES (?, ?, ?, ?, ?, ?,
?)
> [org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement]
>       at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(
> DBDictionary.java:4238)
>       at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(
> DBDictionary.java:4203)
>       at org.apache.openjpa.jdbc.sql.DB2Dictionary.newStoreException(
> DB2Dictionary.java:503)
>       at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(
> SQLExceptions.java:102)
>       at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(
> SQLExceptions.java:72)
>       at
>
org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushBatch(

> BatchingPreparedStatementManagerImpl.java:195)
>       at org.apache.openjpa.jdbc.kernel.MyUpdateManager.flush(
> MyUpdateManager.java:357)
>       at org.apache.openjpa.jdbc.kernel.MyUpdateManager.flush(
> MyUpdateManager.java:77)
>       at org.apache.openjpa.jdbc.kernel.MyUpdateManager.flush(
> MyUpdateManager.java:60)
>       at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(
> JDBCStoreManager.java:655)
>       at org.apache.openjpa.kernel.DelegatingStoreManager.flush(
> DelegatingStoreManager.java:130)
>       at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2010)
>       at org.apache.openjpa.kernel.BrokerImpl.flushSafe(
> BrokerImpl.java:1908)
>       at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1679)
>       at org.apache.openjpa.kernel.DelegatingBroker.flush(
> DelegatingBroker.java:989)
>       at org.apache.openjpa.persistence.EntityManagerImpl.flush(
> EntityManagerImpl.java:592)
>       at com.ibm.sbs.cci.dao.AbstractCaseeDAO.updateCasee(
> AbstractCaseeDAO.java:98)
>       ... 60 more
> Caused by: com.ibm.websphere.ce.cm.DuplicateKeyException: DB2 SQL error:
> SQLCODE: -803, SQLSTATE: 23505, SQLERRMC: 1;DB2ADMIN.CASEE
>       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>       at sun.reflect.NativeConstructorAccessorImpl.newInstance(
> NativeConstructorAccessorImpl.java:67)
>       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
> DelegatingConstructorAccessorImpl.java:45)
>       at java.lang.reflect.Constructor.newInstance(Constructor.java:522)
>       at
> com.ibm.websphere.rsadapter.GenericDataStoreHelper.mapExceptionHelper(
> GenericDataStoreHelper.java:523)
>       at com.ibm.websphere.rsadapter.GenericDataStoreHelper.mapException(
> GenericDataStoreHelper.java:578)
>       at com.ibm.ws.rsadapter.jdbc.WSJdbcUtil.mapException(
> WSJdbcUtil.java:903)
>       at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeUpdate(
> WSJdbcPreparedStatement.java:626)
>       at
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate(
> DelegatingPreparedStatement.java:269)
>       at
>
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeUpdate(

> LoggingConnectionDecorator.java:864)
>       at
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate(
> DelegatingPreparedStatement.java:269)
>       at
>
org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeUpdate(

> JDBCStoreManager.java:1504)
>       at
>
org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.executeUpdate(
> PreparedStatementManagerImpl.java:151)
>       at
>
org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushSingleRow(

> BatchingPreparedStatementManagerImpl.java:217)
>       at
>
org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushBatch(

> BatchingPreparedStatementManagerImpl.java:156)
>       ... 71 more
> [08-10-15 16:51:08:718 CST] 00000074 RegisteredSyn E   WTRN0074E: 从
> before_completion 同步操作捕获异常:<openjpa-1.2.0-r422266:683325
nonfatal
> user error> org.apache.openjpa.persistence.InvalidStateException:
> Encountered unmanaged object in persistent field
> "com.ibm.sbs.cci.pojo.Casee.businessStatus" during flush.  However, this
> field does not allow cascade persist. Set the cascade attribute for this
> field to CascadeType.PERSIST or CascadeType.ALL (JPA annotations) or
> "persist" or "all" (JPA orm.xml), or enable cascade-persist globally, or
> manually persist the related field value prior to flushing. You cannot
> flush unmanaged objects or graphs that have persistent associations to
> unmanaged objects.
> FailedObject: com.ibm.sbs.cci.pojo.CaseStatus-APPROVED
>       at org.apache.openjpa.kernel.SingleFieldManager.preFlushPC(
> SingleFieldManager.java:753)
>       at org.apache.openjpa.kernel.SingleFieldManager.preFlush(
> SingleFieldManager.java:594)
>       at org.apache.openjpa.kernel.SingleFieldManager.preFlush(
> SingleFieldManager.java:562)
>       at org.apache.openjpa.kernel.SingleFieldManager.preFlush(
> SingleFieldManager.java:478)
>       at org.apache.openjpa.kernel.StateManagerImpl.preFlush(
> StateManagerImpl.java:2828)
>       at org.apache.openjpa.kernel.PDirtyState.beforeFlush(
> PDirtyState.java:37)
>       at org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(
> StateManagerImpl.java:959)
>       at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1948)
>       at org.apache.openjpa.kernel.BrokerImpl.flushSafe(
> BrokerImpl.java:1908)
>       at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(
> BrokerImpl.java:1826)
>       at
>
org.apache.openjpa.ee.WASManagedRuntime$WASSynchronization.beforeCompletion(

> WASManagedRuntime.java:304)
>       at
> com.ibm.ws.jtaextensions.SynchronizationCallbackWrapper.beforeCompletion(
> SynchronizationCallbackWrapper.java:65)
>       at com.ibm.ws.Transaction.JTA.RegisteredSyncs.distributeBefore(
> RegisteredSyncs.java:242)
>       at com.ibm.ws.Transaction.JTA.TransactionImpl.prePrepare(
> TransactionImpl.java:2398)
>       at
com.ibm.ws.Transaction.JTA.TransactionImpl.stage1CommitProcessing(
> TransactionImpl.java:1631)
>       at com.ibm.ws.Transaction.JTA.TransactionImpl.processCommit(
> TransactionImpl.java:1602)
>       at com.ibm.ws.Transaction.JTA.TransactionImpl.commit(
> TransactionImpl.java:1537)
>       at com.ibm.ws.Transaction.JTA.TranManagerImpl.commit(
> TranManagerImpl.java:239)
>       at com.ibm.ws.Transaction.JTA.TranManagerSet.commit(
> TranManagerSet.java:163)
>       at com.ibm.ejs.csi.TranStrategy.commit(TranStrategy.java:756)
>       at com.ibm.ejs.csi.TranStrategy.postInvoke(TranStrategy.java:181)
>       at com.ibm.ejs.csi.TransactionControlImpl.postInvoke(
> TransactionControlImpl.java:581)
>       at com.ibm.ejs.container.EJSContainer.postInvoke(
> EJSContainer.java:3910)
>       at
>
com.ibm.wsspi.sca.ejb.module.EJSLocalStatelessModule_43132892.transactionRequiredActivitySessionNotSupported(

> EJSLocalStatelessModule_43132892.java:244)
>       at
>
com.ibm.ws.sca.internal.uow.handler.UOWStrategyImpl.transactionGlobalActivitySessionFalse(

> UOWStrategyImpl.java:311)
>       at
com.ibm.ws.sca.internal.uow.handler.JoinUOWHandler.processMessage(
> JoinUOWHandler.java:165)
>       at
>
com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessageWithPCI(

> MessageDispatcherImpl.java:725)
>       at
>
com.ibm.ws.sca.internal.message.impl.MessageDispatcherImpl.processMessage(
> MessageDispatcherImpl.java:1166)
>       at com.ibm.ws.sca.internal.message.impl.ManagedMessageImpl.process(
> ManagedMessageImpl.java:812)
>       at
> com.ibm.wsspi.sca.ejb.module.impl.ModuleSessionBean.processMessage(
> ModuleSessionBean.java:149)
>       at
>
com.ibm.wsspi.sca.ejb.module.EJSLocalStatelessModule_43132892.processMessage(

> EJSLocalStatelessModule_43132892.java:97)
>       at
>
com.ibm.wbit.comptest.controller.invocation.impl.AdhocInvoker.processMessage(Unknown

>  Source)
>       at
>
com.ibm.wbit.comptest.controller.invocation.impl.Invoker.managedInvoke(Unknown

>  Source)
>       at
> com.ibm.wbit.comptest.controller.invocation.impl.Invoker.invoke(Unknown
> Source)
>       at
>
com.ibm.wbit.comptest.controller.invocation.impl.BaseInvocationHandler.invoke(Unknown

>  Source)
>       at
>
com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager.doInvoke(Unknown

>  Source)
>       at
>
com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager$1.run(Unknown

>  Source)
>       at java.security.AccessController.doPrivileged(
> AccessController.java:219)
>       at javax.security.auth.Subject.doAs(Subject.java:495)
>       at
com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:118)
>       at
>
com.ibm.wbit.comptest.controller.invocation.impl.InvocationManager.invoke(Unknown

>  Source)
>       at
>
com.ibm.wbit.comptest.controller.command.impl.BaseCommandHandler.doCommand(Unknown

>  Source)
>       at
>
com.ibm.wbit.comptest.controller.command.impl.CommandProcessor.doCommand(Unknown

>  Source)
>       at
>
com.ibm.wbit.comptest.controller.command.impl.CommandProcessor.doCommand(Unknown

>  Source)
>       at com.ibm.wbit.comptest.servlet.TestControllerServlet.process(
> TestControllerServlet.java:76)
>       at com.ibm.wbit.comptest.servlet.TestControllerServlet.doPost(
> TestControllerServlet.java:51)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>       at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(
> ServletWrapper.java:995)
>       at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(
> ServletWrapper.java:501)
>       at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(
> ServletWrapper.java:464)
>       at
com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(
> CacheServletWrapper.java:90)
>       at com.ibm.ws.webcontainer.WebContainer.handleRequest(
> WebContainer.java:744)
>       at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(
> WebContainer.java:1455)
>       at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(
> WCChannelLink.java:113)
>       at
>
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(
> HttpInboundLink.java:454)
>       at
>
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(
> HttpInboundLink.java:383)
>       at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(
> HttpInboundLink.java:263)
>       at
>
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(

> NewConnectionInitialReadCallback.java:214)
>       at
> com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(
> NewConnectionInitialReadCallback.java:113)
>       at
> com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(
> AioReadCompletionListener.java:165)
>       at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(
> AbstractAsyncFuture.java:217)
>       at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(
> AsyncChannelFuture.java:161)
>       at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
>       at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
>       at com.ibm.io.async.ResultHandler.runEventProcessingLoop(
> ResultHandler.java:743)
>       at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
>       at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
> 5. According to my analysis,
>       CaseStatus cStatus = statusDAO.findByCaseStatusPK(caseeStatus);
---
> cStatus with StateManagerImpl & PNonTransState
>       Casee casee = caseDAO.findByCaseePKWithRef(caseeId);
---
> casee with StateManagerImpl & PNonTransState
>       casee.setBusinessStatus(cStatus);
---
> casee with StateManagerImpl & PDirtyState
>       caseDAO.updateCasee(casee);
---
> in updateCasee method, casee(PDirtyTransState -> PNewState)
>       em = emf.createEntityManager();
>       em.joinTransaction();
>       Casee mergedcasee = em.merge(casee);
---
> casee with StateManagerImpl & PDirtyState
>
---
> mergedcasee with StateManagerImpl & PNewState
>       em.flush();
---
> Here, a record would be inserted into DB
>       em.close();

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.