<testcase time="0.205" classname="org.apache.openjpa.persistence.datacache.TestDataCacheBehavesIdentical" name="testDirtyRefreshWithoutDataCacheAlwaysHitsDatabase">
<error message="The transaction has been rolled back. See the nested exceptions for details on the errors that occurred." type="<openjpa-2.3.0-SNAPSHOT-r422266"><openjpa-2.3.0-SNAPSHOT-r422266:1331053 fatal store error> org.apache.openjpa.persistence.RollbackException: The transaction has been rolled back. See the nested exceptions for details on the errors that occurred.
FailedObject: org.apache.openjpa.persistence.datacache.common.apps.PObject@3fc25500
at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:594)
at org.apache.openjpa.persistence.datacache.TestDataCacheBehavesIdentical.verifyRefresh(TestDataCacheBehavesIdentical.java:320)
at org.apache.openjpa.persistence.datacache.TestDataCacheBehavesIdentical.testDirtyRefreshWithoutDataCacheAlwaysHitsDatabase(TestDataCacheBehavesIdentical.java:438)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at junit.framework.TestCase.runTest(TestCase.java:154)
at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runTest(AbstractPersistenceTestCase.java:579)
at junit.framework.TestCase.runBare(TestCase.java:127)
at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(AbstractPersistenceTestCase.java:566)
at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(AbstractPersistenceTestCase.java:542)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.run(AbstractPersistenceTestCase.java:206)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at sun.reflect.GeneratedMethodAccessor196.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:115)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:102)
at org.apache.maven.surefire.Surefire.run(Surefire.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)
Caused by: <openjpa-2.3.0-SNAPSHOT-r422266:1331053 fatal store error> org.apache.openjpa.persistence.EntityExistsException: The transaction has been rolled back. See the nested exceptions for details on the errors that occurred.
FailedObject: org.apache.openjpa.persistence.datacache.common.apps.PObject@3fc25500
at org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2339)
at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2176)
at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2074)
at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1992)
at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81)
at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1516)
at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:933)
at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:570)
... 31 more
Caused by: <openjpa-2.3.0-SNAPSHOT-r422266:1331053 fatal store error> org.apache.openjpa.persistence.EntityExistsException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL120427103931820' defined on 'L2_POBJECT'.

{prepstmnt 268651183 INSERT INTO L2_PObject (id, name, version) VALUES (?, ?, ?)} [code=20000, state=23505]
FailedObject: org.apache.openjpa.persistence.datacache.common.apps.PObject@3fc25500
at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4910)
at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4885)
at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:136)
at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:78)
at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushAndUpdate(PreparedStatementManagerImpl.java:143)
at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushInternal(PreparedStatementManagerImpl.java:99)
at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flush(PreparedStatementManagerImpl.java:87)
at org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:550)
at org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:106)
at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:103)
at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:76)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:735)
at org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:131)
... 38 more
Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL120427103931820' defined on 'L2_POBJECT'. {prepstmnt 268651183 INSERT INTO L2_PObject (id, name, version) VALUES (?, ?, ?)}

[code=20000, state=23505]
at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:219)
at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:195)
at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$1000(LoggingConnectionDecorator.java:59)
at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeUpdate(LoggingConnectionDecorator.java:1134)
at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:272)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeUpdate(JDBCStoreManager.java:1763)
at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.executeUpdate(PreparedStatementManagerImpl.java:267)
at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushAndUpdate(PreparedStatementManagerImpl.java:118)
... 46 more
</error>

Activity

I haven't dug into this one, but I found if I change the annotation on org.apache.openjpa.persistence.datacache.common.apps.PObject.id from @GeneratedValue to @GeneratedValue(strategy=GenerationType.AUTO), the test passes.

Rick Curtis
added a comment - 30/Apr/12 16:24 I haven't dug into this one, but I found if I change the annotation on org.apache.openjpa.persistence.datacache.common.apps.PObject.id from @GeneratedValue to @GeneratedValue(strategy=GenerationType.AUTO), the test passes.