openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Web developer <webautomat...@gmail.com>
Subject Mapping tool
Date Mon, 31 May 2010 14:29:33 GMT
I still can't understand how to force a proper generation of sequence table.
I can't understand why sequence table could not be found in my HSQLDB
database. I added external builder to Eclipse (forces mapping tool to
execute). Here goes:

-classpath
/home/webautomator/openjpa-all-2.0.0-beta3.jar:${workspace_loc:/openJPA/src}:${workspace_loc:/openJPA/bin}:/usr/share/java/log4j-1.2.15.jar
org.apache.openjpa.enhance.PCEnhancer -directory
${workspace_loc:/openJPA/bin} User Phone Address ContactInfo

-Dopenjpa.Log=SQL=trace -classpath
/home/webautomator/openjpa-all-2.0.0-beta3.jar:/home/webautomator/hsqldb.jar:/usr/share/java/log4j-1.2.15.jar
org.apache.openjpa.jdbc.kernel.TableJDBCSeq -p
${workspace_loc}/${project_name}/src/META-INF/persistence.xml
-ConnectionDriverName org.hsqldb.jdbc.JDBCDriver -ConnectionURL
jdbc:hsqldb:mem:persist_backend;create=true -Dopenjpa.ConnectionUserName=SA
-a add

-Dopenjpa.jdbc.Schema=SQL=TRACE -Dopenjpa.Log=SQL=TRACE -classpath
/home/webautomator/openjpa-all-2.0.0-beta3.jar:${workspace_loc}/${project_name}/bin:/home/webautomator/hsqldb.jar
org.apache.openjpa.jdbc.meta.MappingTool -sequences true -meta true -p
${workspace_loc}/${project_name}/src/META-INF/persistence.xml
-ConnectionDriverName org.hsqldb.jdbc.JDBCDriver -ConnectionURL
jdbc:hsqldb:mem:persist_backend -Dopenjpa.ConnectionUserName=SA Address.java
ContactInfo.java Phone.java User.java

-classpath
/home/webautomator/openjpa-all-2.0.0-beta3.jar:${workspace_loc}/${project_name}/bin:/home/webautomator/hsqldb.jar
org.apache.openjpa.jdbc.meta.MappingTool -action validate -p
${workspace_loc}/${project_name}/src/META-INF/persistence.xml
-ConnectionDriverName org.hsqldb.jdbc.JDBCDriver -ConnectionURL
jdbc:hsqldb:mem:persist_backend -Dopenjpa.ConnectionUserName=SA Address.java
ContactInfo.java Phone.java User.java

318  embeddables  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class
"org.apache.openjpa.jdbc.sql.HSQLDictionary".
709  embeddables  INFO   [main] openjpa.Tool - Mapping tool running on type
"class User" with action "buildSchema".
1360  embeddables  INFO   [main] openjpa.Tool - Mapping tool running on type
"class ContactInfo" with action "buildSchema".
1376  embeddables  INFO   [main] openjpa.Tool - Mapping tool running on type
"class Phone" with action "buildSchema".
1376  embeddables  INFO   [main] openjpa.Tool - Recording mapping and schema
changes.
2763  embeddables  TRACE  [main] openjpa.jdbc.SQL - <t 1770446243, conn
356593269> executing stmnt 1491218219 CREATE TABLE OPENJPA_SEQUENCE_TABLE
(ID TINYINT NOT NULL, SEQUENCE_VALUE BIGINT, PRIMARY KEY (ID))
2764  embeddables  TRACE  [main] openjpa.jdbc.SQL - <t 1770446243, conn
356593269> [1 ms] spent
2766  embeddables  TRACE  [main] openjpa.jdbc.SQL - <t 1770446243, conn
1041044265> executing stmnt 65098484 CREATE TABLE User0 (id INTEGER NOT
NULL, user VARCHAR(255), user_name VARCHAR(255), city VARCHAR(255), state
VARCHAR(255), street VARCHAR(255), zip INTEGER, number VARCHAR(255), type
VARCHAR(255), PRIMARY KEY (id))
2769  embeddables  TRACE  [main] openjpa.jdbc.SQL - <t 1770446243, conn
1041044265> [2 ms] spent
2770  embeddables  TRACE  [main] openjpa.jdbc.SQL - <t 1770446243, conn
1031651787> executing stmnt 589734556 CREATE TABLE user_addresses (USER_ID
INTEGER, city VARCHAR(255), state VARCHAR(255), street VARCHAR(255), zip
INTEGER)
2771  embeddables  TRACE  [main] openjpa.jdbc.SQL - <t 1770446243, conn
1031651787> [1 ms] spent
2773  embeddables  TRACE  [main] openjpa.jdbc.SQL - <t 1770446243, conn
1952528191> executing stmnt 420745445 CREATE INDEX I_SR_DSSS_USER_ID ON
user_addresses (USER_ID)
2773  embeddables  TRACE  [main] openjpa.jdbc.SQL - <t 1770446243, conn
1952528191> [0 ms] spent

353  embeddables  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class
"org.apache.openjpa.jdbc.sql.HSQLDictionary".
469  embeddables  INFO   [main] openjpa.Tool - Mapping tool running on type
"class User" with action "validate".
Exception in thread "main" <openjpa-2.0.0-beta3-r422266:926797 fatal user
error> org.apache.openjpa.util.MetaDataException: Errors encountered while
resolving metadata.  See nested exceptions for details.
    at
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:642)
    at
org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:385)
    at
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:358)
    at
org.apache.openjpa.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:355)
    at
org.apache.openjpa.jdbc.meta.MappingTool.getMapping(MappingTool.java:679)
    at
org.apache.openjpa.jdbc.meta.MappingTool.validate(MappingTool.java:737)
    at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:653)
    at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:1075)
    at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:989)
    at org.apache.openjpa.jdbc.meta.MappingTool$1.run(MappingTool.java:930)
    at
org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:725)
    at
org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:715)
    at org.apache.openjpa.jdbc.meta.MappingTool.main(MappingTool.java:925)
Caused by: <openjpa-2.0.0-beta3-r422266:926797 fatal user error>
org.apache.openjpa.util.MetaDataException: Table "User0" given for "User"
does not exist.
    at
org.apache.openjpa.jdbc.meta.MappingInfo.createTable(MappingInfo.java:532)
    at
org.apache.openjpa.jdbc.meta.ClassMappingInfo.getTable(ClassMappingInfo.java:309)
    at
org.apache.openjpa.jdbc.meta.ClassMappingInfo.getTable(ClassMappingInfo.java:331)
    at
org.apache.openjpa.jdbc.meta.strats.FullClassStrategy.map(FullClassStrategy.java:73)
    at
org.apache.openjpa.jdbc.meta.ClassMapping.setStrategy(ClassMapping.java:391)
    at
org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:56)
    at
org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:411)
    at
org.apache.openjpa.meta.MetaDataRepository.preMapping(MetaDataRepository.java:736)
    at
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:625)
    ... 12 more
NestedThrowables:
<openjpa-2.0.0-beta3-r422266:926797 fatal user error>
org.apache.openjpa.util.MetaDataException: Table "User0" given for "User"
does not exist.
    at
org.apache.openjpa.jdbc.meta.MappingInfo.createTable(MappingInfo.java:532)
    at
org.apache.openjpa.jdbc.meta.ClassMappingInfo.getTable(ClassMappingInfo.java:309)
    at
org.apache.openjpa.jdbc.meta.ClassMappingInfo.getTable(ClassMappingInfo.java:331)
    at
org.apache.openjpa.jdbc.meta.strats.FullClassStrategy.map(FullClassStrategy.java:73)
    at
org.apache.openjpa.jdbc.meta.ClassMapping.setStrategy(ClassMapping.java:391)
    at
org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:56)
    at
org.apache.openjpa.jdbc.meta.ClassMapping.resolveMapping(ClassMapping.java:820)
    at
org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1791)
    at
org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:790)
    at
org.apache.openjpa.meta.MetaDataRepository.resolveMapping(MetaDataRepository.java:751)
    at
org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:631)
    at
org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:385)
    at
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:358)
    at
org.apache.openjpa.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:355)
    at
org.apache.openjpa.jdbc.meta.MappingTool.getMapping(MappingTool.java:679)
    at
org.apache.openjpa.jdbc.meta.MappingTool.validate(MappingTool.java:737)
    at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:653)
    at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:1075)
    at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:989)
    at org.apache.openjpa.jdbc.meta.MappingTool$1.run(MappingTool.java:930)
    at
org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:725)
    at
org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:715)
    at org.apache.openjpa.jdbc.meta.MappingTool.main(MappingTool.java:925)

As anyone can understand - those table where not found via manual check
(SELECT * FROM INF..MA.TABLES). And runner says the same thing:

244  embeddables  INFO   [main] openjpa.Runtime - Starting OpenJPA
2.0.0-beta3
438  embeddables  INFO   [main] openjpa.jdbc.JDBC - Using dictionary class
"org.apache.openjpa.jdbc.sql.HSQLDictionary".
Exception in thread "main" <openjpa-2.0.0-beta3-r422266:926797 fatal store
error> org.apache.openjpa.persistence.RollbackException: user lacks
privilege or object not found: OPENJPA_SEQUENCE_TABLE {SELECT SEQUENCE_VALUE
FROM OPENJPA_SEQUENCE_TABLE WHERE ID = ?} [code=-5501, state=42501]
    at
org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:573)
    at Main.init(Main.java:55)
    at Main.main(Main.java:10)
Caused by: <openjpa-2.0.0-beta3-r422266:926797 fatal general error>
org.apache.openjpa.persistence.PersistenceException: user lacks privilege or
object not found: OPENJPA_SEQUENCE_TABLE {SELECT SEQUENCE_VALUE FROM
OPENJPA_SEQUENCE_TABLE WHERE ID = ?} [code=-5501, state=42501]
    at
org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4827)
    at
org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4787)
    at
org.apache.openjpa.jdbc.sql.HSQLDictionary.newStoreException(HSQLDictionary.java:318)
    at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:136)
    at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:110)
    at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:62)
    at
org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq.next(AbstractJDBCSeq.java:66)
    at org.apache.openjpa.util.ImplHelper.generateValue(ImplHelper.java:160)
    at
org.apache.openjpa.util.ImplHelper.generateFieldValue(ImplHelper.java:144)
    at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignField(JDBCStoreManager.java:786)
    at
org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:487)
    at
org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:463)
    at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignObjectId(JDBCStoreManager.java:770)
    at
org.apache.openjpa.kernel.DelegatingStoreManager.assignObjectId(DelegatingStoreManager.java:134)
    at
org.apache.openjpa.kernel.StateManagerImpl.assignObjectId(StateManagerImpl.java:605)
    at
org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManagerImpl.java:2952)
    at org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:40)
    at
org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(StateManagerImpl.java:1047)
    at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2060)
    at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2020)
    at
org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1938)
    at
org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:81)
    at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1462)
    at
org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:924)
    at
org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:556)
    ... 2 more
Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: user lacks
privilege or object not found: OPENJPA_SEQUENCE_TABLE {SELECT SEQUENCE_VALUE
FROM OPENJPA_SEQUENCE_TABLE WHERE ID = ?} [code=-5501, state=42501]
    at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:257)
    at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:237)
    at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$000(LoggingConnectionDecorator.java:70)
    at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection.prepareStatement(LoggingConnectionDecorator.java:289)
    at
org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareStatement(DelegatingConnection.java:186)
    at
org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.prepareStatement(ConfiguringConnectionDecorator.java:155)
    at
org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareStatement(DelegatingConnection.java:175)
    at
org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java:549)
    at
org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java:529)
    at
org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java:518)
    at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.prepareStatement(TableJDBCSeq.java:806)
    at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.getSequence(TableJDBCSeq.java:545)
    at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.setSequence(TableJDBCSeq.java:587)
    at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq$AllocateSequenceRunnable.run(TableJDBCSeq.java:892)
    at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.allocateSequence(TableJDBCSeq.java:454)
    at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.nextInternal(TableJDBCSeq.java:305)
    at
org.apache.openjpa.jdbc.kernel.AbstractJDBCSeq.next(AbstractJDBCSeq.java:60)
    ... 20 more

Arguments:

-Dopenjpa.ConnectionDriverName=org.hsqldb.jdbc.JDBCDriver
-Dopenjpa.ConnectionURL=jdbc:hsqldb:mem:persist_backend
-Dopenjpa.DynamicEnhancementAgent=false
-Dopenjpa.RuntimeUnenhancedClasses=unsupported
-Dopenjpa.ConnectionUserName=SA

Backend was changed. It is mem now. John

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message