Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 363519 - jpa tests failed with "Error preallocating sequence numbers. The sequence table information is not complete" on H2 with 1.3.161 driver
Summary: jpa tests failed with "Error preallocating sequence numbers. The sequence tab...
Status: RESOLVED WONTFIX
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard: h2
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-10 14:03 EST by Yiping Zhao CLA
Modified: 2022-06-09 10:25 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yiping Zhao CLA 2011-11-10 14:03:24 EST
Recently I upgraded H2 database from 1.2.144 to 1.3.161, 13 jpa tests failed on H2. You can see trunk test results here:

http://ottvm054.ca.oracle.com/eclipselink/main/2011-11-10/jpa-eclipselink.jpa.test-test-lrg-jdk16-h2-1.2-h2.html

I tried to run jpa lrg tests on old H2 1.2.144 database using old H2 1.2.144 driver, all tests passed as before; I ran same tests on old H2 1.2.144 database using new H2 1.3.161 driver, the tests will fail. It seems that the changes in 1.3.161 driver make jpa tests fail.

1. The failed tests are:
 org.eclipse.persistence.testing.tests.jpa.complexaggregate.AggregatePrimaryKeyTest.AggregatePrimaryKeyTest  org.eclipse.persistence.testing.tests.jpa.complexaggregate.AggregatePrimaryKeyOrderByTest.AggregatePrimaryKeyOrderByTest  org.eclipse.persistence.testing.tests.jpa.advanced.EntityManagerJUnitTestSuite.testDeleteMan 
org.eclipse.persistence.testing.tests.jpa.advanced.AdvancedJunitTest.testManAndWoman  org.eclipse.persistence.testing.tests.jpa.advanced.AdvancedJunitTest.testCreateDerivedPKFromPKValues   org.eclipse.persistence.testing.tests.jpa.advanced.compositepk.AdvancedCompositePKJunitTest.testIdentitySequencingForDerivedId  org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.AdvancedJunitTest.testBUG241388  org.eclipse.persistence.testing.tests.jpa.fieldaccess.advanced.AdvancedJunitTest.testLazyToInterface 
org.eclipse.persistence.testing.tests.jpa.jpql.JUnitJPQLComplexTestSuite.testSetup  org.eclipse.persistence.testing.tests.jpa.jpql.JUnitJPQLComplexTestSuite.updateWhereExistsTest  org.eclipse.persistence.testing.tests.jpa.jpql.JUnitJPQLComplexTestSuite.deleteWhereExistsTest
org.eclipse.persistence.testing.tests.jpa.xml.advanced.AdvancedJunitTest.testManAndWoman
org.eclipse.persistence.testing.tests.jpa.jpql.JUnitJPQLComplexTestSuite.testFunctionInOrderBy
 

2. The error message for the first 12 tests is same as follwoing:
Exception Description: Fatal error occurred. Internal Exception: javax.persistence.RollbackException: Exception [EclipseLink-4011] (Eclipse Persistence Services - 2.4.0.v20111110-r10361): org.eclipse.persistence.exceptions.DatabaseException Exception Description: Error preallocating sequence numbers. The sequence table information is not complete. 

Local Exception Stack: 
Exception [EclipseLink-0] (Eclipse Persistence Services - 2.4.0.v20111110-r10361): org.eclipse.persistence.testing.framework.TestErrorException
Exception Description: Fatal error occurred.
Internal Exception: javax.persistence.RollbackException: Exception [EclipseLink-4011] (Eclipse Persistence Services - 2.4.0.v20111110-r10361): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Error preallocating sequence numbers. The sequence table information is not complete.
at org.eclipse.persistence.testing.framework.TestCase.execute(TestCase.java:166)
at org.eclipse.persistence.testing.framework.TestCase.runBare(TestCase.java:265)
at org.eclipse.persistence.testing.framework.TestExecutor.execute(TestExecutor.java:248)
at org.eclipse.persistence.testing.framework.TestModel.execute(TestModel.java:211)
at org.eclipse.persistence.testing.framework.TestCollection.run(TestCollection.java:313)
at org.eclipse.persistence.testing.framework.TestExecutor.execute(TestExecutor.java:248)
at org.eclipse.persistence.testing.framework.TestModel.execute(TestModel.java:211)
at org.eclipse.persistence.testing.framework.TestCollection.run(TestCollection.java:313)
Caused by: javax.persistence.RollbackException: Exception [EclipseLink-4011] (Eclipse Persistence Services - 2.4.0.v20111110-r10361): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Error preallocating sequence numbers. The sequence table information is not complete.
at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:102)
at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:63)
at org.eclipse.persistence.testing.tests.jpa.EntityContainerTestBase.commitTransaction(EntityContainerTestBase.java:46)
at org.eclipse.persistence.testing.tests.jpa.complexaggregate.AggregatePrimaryKeyTest.test(AggregatePrimaryKeyTest.java:67)
at org.eclipse.persistence.testing.framework.TestCase.executeTest(TestCase.java:545)
at org.eclipse.persistence.testing.framework.TestCase.execute(TestCase.java:156)
Caused by: Exception [EclipseLink-4011] (Eclipse Persistence Services - 2.4.0.v20111110-r10361): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Error preallocating sequence numbers. The sequence table information is not complete.
at org.eclipse.persistence.exceptions.DatabaseException.errorPreallocatingSequenceNumbers(DatabaseException.java:143)
at org.eclipse.persistence.sequencing.StandardSequence.getGeneratedValue(StandardSequence.java:63)
at org.eclipse.persistence.sequencing.Sequence.getGeneratedValue(Sequence.java:225)
at org.eclipse.persistence.internal.sequencing.SequencingManager$NoPreallocation_State.getNextValue(SequencingManager.java:677)
at org.eclipse.persistence.internal.sequencing.SequencingManager.getNextValue(SequencingManager.java:1067)
at org.eclipse.persistence.internal.sequencing.ClientSessionSequencing.getNextValue(ClientSessionSequencing.java:70)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.assignSequenceNumber(ObjectBuilder.java:349)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.assignSequenceNumber(ObjectBuilder.java:322)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.updateObjectAndRowWithSequenceNumber(DatabaseQueryMechanism.java:841)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:351)
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:162)
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:177)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:472)
at org.eclipse.persistence.queries.InsertObjectQuery.executeCommit(InsertObjectQuery.java:80)
at org.eclipse.persistence.queries.InsertObjectQuery.executeCommitWithChangeSet(InsertObjectQuery.java:90)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:287)
at org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:844)
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:743)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2871)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1515)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1497)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1448)
at org.eclipse.persistence.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:224)
at org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsForClassWithChangeSet(CommitManager.java:191)
at org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:136)
at org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:3798)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1415)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:636)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1505)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:267)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:1143)
at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:84)

3. The error message for the last test case is:

Internal Exception: org.h2.jdbc.JdbcSQLException: Table "CMP3_WRAPPER_TYPES" not found; SQL statement: SELECT WT_ID, BIGDECIMAL_DATA, BIGINTEGER_DATA, BOOLEAN_DATA, BYTE_DATA, CHARACTER_DATA, DOUBLE_DATA, FLOAT_DATA, INTEGER_DATA, LONG_DATA, SHORT_DATA, STRING_DATA FROM CMP3_WRAPPER_TYPES ORDER BY BOOLEAN_DATA ASC [42102-161] Error Code: 42102 Call: SELECT WT_ID, BIGDECIMAL_DATA, BIGINTEGER_DATA, BOOLEAN_DATA, BYTE_DATA, CHARACTER_DATA, DOUBLE_DATA, FLOAT_DATA, INTEGER_DATA, LONG_DATA, SHORT_DATA, STRING_DATA FROM CMP3_WRAPPER_TYPES ORDER BY BOOLEAN_DATA ASC Query: ReadAllQuery(referenceClass=WrapperTypes sql="SELECT WT_ID, BIGDECIMAL_DATA, BIGINTEGER_DATA, BOOLEAN_DATA, BYTE_DATA, CHARACTER_DATA, DOUBLE_DATA, FLOAT_DATA, INTEGER_DATA, LONG_DATA, SHORT_DATA, STRING_DATA FROM CMP3_WRAPPER_TYPES ORDER BY BOOLEAN_DATA ASC") 

Local Exception Stack: 
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20111110-r10361): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.h2.jdbc.JdbcSQLException: Table "CMP3_WRAPPER_TYPES" not found; SQL statement:
SELECT WT_ID, BIGDECIMAL_DATA, BIGINTEGER_DATA, BOOLEAN_DATA, BYTE_DATA, CHARACTER_DATA, DOUBLE_DATA, FLOAT_DATA, INTEGER_DATA, LONG_DATA, SHORT_DATA, STRING_DATA FROM CMP3_WRAPPER_TYPES ORDER BY BOOLEAN_DATA ASC [42102-161]
Error Code: 42102
Call: SELECT WT_ID, BIGDECIMAL_DATA, BIGINTEGER_DATA, BOOLEAN_DATA, BYTE_DATA, CHARACTER_DATA, DOUBLE_DATA, FLOAT_DATA, INTEGER_DATA, LONG_DATA, SHORT_DATA, STRING_DATA FROM CMP3_WRAPPER_TYPES ORDER BY BOOLEAN_DATA ASC
Query: ReadAllQuery(referenceClass=WrapperTypes sql="SELECT WT_ID, BIGDECIMAL_DATA, BIGINTEGER_DATA, BOOLEAN_DATA, BYTE_DATA, CHARACTER_DATA, DOUBLE_DATA, FLOAT_DATA, INTEGER_DATA, LONG_DATA, SHORT_DATA, STRING_DATA FROM CMP3_WRAPPER_TYPES ORDER BY BOOLEAN_DATA ASC")
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:644)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:535)
at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:1716)
at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:566)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:207)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:193)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:264)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:646)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2672)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2631)
at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:420)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1082)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:844)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1041)
at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:392)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1129)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2871)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1515)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1497)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1462)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:485)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getResultList(EJBQueryImpl.java:742)
at org.eclipse.persistence.testing.tests.jpa.jpql.JUnitJPQLComplexTestSuite.testFunctionInOrderBy(JUnitJPQLComplexTestSuite.java:3201)
Comment 1 James Sutherland CLA 2012-06-13 11:33:47 EDT
I debugged the issue, and it is a bug in the H2 database.
The issue occurs because some of the tests have a default query timeout.  When you set the query timeout in H2 on the JDBC statement it for some reason clears the last identity value.  So sequencing does not work.

This is a bug in H2 and a regression, as the previous version of H2 worked.

I'm not sure what we can do about this.  We could change our tests to not set the timeout (as we do for Posgres) but H2 does support timeouts, it just breaks identity.
Comment 2 Martin Grebac CLA 2014-12-10 14:38:51 EST
External bug.
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:25:19 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink