Issue Details (XML | Word | Printable)

Key: NUCRDBMS-561
Type: Improvement Improvement
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: Testcase Required Testcase Required
Assignee: Unassigned
Reporter: subes
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Store RDBMS

Using 'increment' table name of "SEQUENCES" on H2 clashes with H2 system table

Created: 02/Oct/11 07:30 PM   Updated: 15/May/13 09:32 AM   Resolved: 14/Apr/13 06:09 PM
Component/s: Value Generation
Affects Version/s: 3.0.2
Fix Version/s: None

File Attachments: 1. Zip Archive tablegenerator.zip (6 kB)


Datastore: H2
Severity: Development


 Description  « Hide
using the following annotations:
@Id
@TableGenerator(name = "AEntity_id_generatorStrategy", table = "SEQUENCES", allocationSize = 1000)
@GeneratedValue(strategy = GenerationType.TABLE, generator = "AEntity_id_generatorStrategy")
private Long id;

produces the following exception:
org.springframework.orm.jpa.JpaSystemException: Couldnt obtain a new sequence (unique id) : Tabelle "SEQUENCES" nicht gefunden
Table "SEQUENCES" not found; SQL statement:
SELECT "NEXT_VAL" FROM "SEQUENCES" WHERE "SEQUENCE_NAME"=? FOR UPDATE [42102-159]; nested exception is javax.persistence.PersistenceException: Couldnt obtain a new sequence (unique id) : Tabelle "SEQUENCES" nicht gefunden
Table "SEQUENCES" not found; SQL statement:
SELECT "NEXT_VAL" FROM "SEQUENCES" WHERE "SEQUENCE_NAME"=? FOR UPDATE [42102-159]
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:311)
at org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect.ajc$afterThrowing$org_springframework_orm_jpa_aspectj_JpaExceptionTranslatorAspect$1$18a1ac9(JpaExceptionTranslatorAspect.aj:15)
at de.invesdwin.gemeinsam.persistenz.api.ADao.schreibe(ADao.java:146)
at de.invesdwin.gemeinsam.persistenz.TestDaoPerformanceTest.setUpOnce(TestDaoPerformanceTest.java:27)
at de.invesdwin.gemeinsam.test.ATest.setUp(ATest.java:69)
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:616)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: javax.persistence.PersistenceException: Couldnt obtain a new sequence (unique id) : Tabelle "SEQUENCES" nicht gefunden
Table "SEQUENCES" not found; SQL statement:
SELECT "NEXT_VAL" FROM "SEQUENCES" WHERE "SEQUENCE_NAME"=? FOR UPDATE [42102-159]
at org.datanucleus.api.jpa.NucleusJPAHelper.getJPAExceptionForNucleusException(NucleusJPAHelper.java:321)
at org.datanucleus.api.jpa.JPAEntityManager.persist(JPAEntityManager.java:500)
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:616)
at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240)
at $Proxy61.persist(Unknown Source)
... 41 more
Caused by: org.h2.jdbc.JdbcSQLException: Tabelle "SEQUENCES" nicht gefunden
Table "SEQUENCES" not found; SQL statement:
SELECT "NEXT_VAL" FROM "SEQUENCES" WHERE "SEQUENCE_NAME"=? FOR UPDATE [42102-159]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:169)
at org.h2.message.DbException.get(DbException.java:146)
at org.h2.command.Parser.readTableOrView(Parser.java:4747)
at org.h2.command.Parser.readTableFilter(Parser.java:1075)
at org.h2.command.Parser.parseSelectSimpleFromPart(Parser.java:1679)
at org.h2.command.Parser.parseSelectSimple(Parser.java:1786)
at org.h2.command.Parser.parseSelectSub(Parser.java:1673)
at org.h2.command.Parser.parseSelectUnion(Parser.java:1518)
at org.h2.command.Parser.parseSelect(Parser.java:1506)
at org.h2.command.Parser.parsePrepared(Parser.java:405)
at org.h2.command.Parser.parse(Parser.java:279)
at org.h2.command.Parser.parse(Parser.java:251)
at org.h2.command.Parser.prepareCommand(Parser.java:217)
at org.h2.engine.Session.prepareLocal(Session.java:415)
at org.h2.engine.Session.prepareCommand(Session.java:364)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1119)
at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:71)
at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:267)
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:616)
at com.jolbox.bonecp.MemorizeTransactionProxy.runWithPossibleProxySwap(MemorizeTransactionProxy.java:245)
at com.jolbox.bonecp.MemorizeTransactionProxy.invoke(MemorizeTransactionProxy.java:176)
at $Proxy55.prepareStatement(Unknown Source)
at com.jolbox.bonecp.ConnectionHandle.prepareStatement(ConnectionHandle.java:850)
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:616)
at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.invoke(LazyConnectionDataSourceProxy.java:376)
at $Proxy56.prepareStatement(Unknown Source)
at org.datanucleus.store.rdbms.SQLController.getStatementForQuery(SQLController.java:327)
at org.datanucleus.store.rdbms.SQLController.getStatementForQuery(SQLController.java:267)
at org.datanucleus.store.rdbms.valuegenerator.SequenceTable.getNextVal(SequenceTable.java:195)
at org.datanucleus.store.rdbms.valuegenerator.TableGenerator.reserveBlock(TableGenerator.java:190)
at org.datanucleus.store.valuegenerator.AbstractGenerator.reserveBlock(AbstractGenerator.java:305)
at org.datanucleus.store.rdbms.valuegenerator.AbstractRDBMSGenerator.obtainGenerationBlock(AbstractRDBMSGenerator.java:170)
at org.datanucleus.store.valuegenerator.AbstractGenerator.obtainGenerationBlock(AbstractGenerator.java:197)
at org.datanucleus.store.valuegenerator.AbstractGenerator.next(AbstractGenerator.java:105)
at org.datanucleus.store.rdbms.RDBMSStoreManager.getStrategyValueForGenerator(RDBMSStoreManager.java:1219)
at org.datanucleus.store.AbstractStoreManager.getStrategyValue(AbstractStoreManager.java:1524)
at org.datanucleus.state.JDOStateManagerImpl.populateStrategyFields(JDOStateManagerImpl.java:740)
at org.datanucleus.state.JDOStateManagerImpl.initialiseForPersistentNew(JDOStateManagerImpl.java:367)
at org.datanucleus.state.ObjectProviderFactory.newForPersistentNew(ObjectProviderFactory.java:163)
at org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java:1807)
at org.datanucleus.ObjectManagerImpl.persistObjectWork(ObjectManagerImpl.java:1657)
at org.datanucleus.ObjectManagerImpl.persistObject(ObjectManagerImpl.java:1514)
at org.datanucleus.api.jpa.JPAEntityManager.persist(JPAEntityManager.java:496)
... 47 more

see attachment for the logs


Sort Order: Ascending order - Click to sort in descending order
subes added a comment - 02/Oct/11 07:33 PM
the involved classes and logs

Andy Jefferson added a comment - 02/Oct/11 08:08 PM
Please revisit DN problem reporting guide
http://www.datanucleus.org/project/problem_jpa_testcase.html

Andy Jefferson added a comment - 02/Oct/11 08:26 PM
Presumably because H2 replies with "this table already exists", and is actually a SYSTEM TABLE (as opposed to something usable by a persistence solution). Set the name to something that is non-system

subes added a comment - 02/Oct/11 08:42 PM - edited
The workaround helped, though interestingly hibernate successfully created the SEQUENCES table and worked fine with it. Thanks.

Andy Jefferson added a comment - 03/Oct/11 07:23 AM
Outcome is likely provide a better message, but then the user has all under their control to use TABLE strategy with a non-system table anyway

Andy Jefferson added a comment - 14/Apr/13 06:09 PM
User seemingly not interested in providing a simple testcase for this