openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jewettdiane <jewettdi...@gmail.com>
Subject MappingTool create index fails
Date Mon, 20 Jul 2009 18:05:11 GMT

Using H2 database and Spring for testing:

<bean id="entityManagerFactory"
	
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
		<property name="persistenceUnitName" value="testPersistenceUnit" />
		<property name="dataSource" ref="dataSource" />
		<property name="jpaVendorAdapter">
			<bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
				<property name="showSql" value="true" />
				<property name="generateDdl" value="true" />
				<property name="database" value="H2" />
			</bean>
		</property>
		<property name="jpaPropertyMap">
			<map>
				<entry key="openjpa.SynchronizeMappings"
value="buildSchema(SchemaAction=add,deleteTableContents,ForeignKeys=true)"
/>
				<entry key="openjpa.Log" value="File=stdout, DefaultLevel=TRACE,
SQL=TRACE" />
				<entry key="openjpa.jdbc.DBDictionary"
value="org.apache.openjpa.jdbc.sql.H2Dictionary(useGetObjectForBlobs=false)"
/><!--
				<entry key="openjpa.jdbc.UpdateManager" value="operation-order" />
				--><entry key="openjpa.ConnectionFactoryProperties"
value="PrettyPrint=true, PrettyPrintLineLength=72" />
			</map>
		</property>
		<property name="loadTimeWeaver">
			<bean
				class="org.springframework.instrument.classloading.SimpleLoadTimeWeaver"
/>
		</property>
	</bean>


Console:
437  testPersistenceUnit  TRACE  [main] openjpa.jdbc.SQL - <t 109577864,
conn 1115112055> executing stmnt 2093513928 
CREATE TABLE EMPLOYMENT (EMPLOYMENT_ID BIGINT NOT NULL, LST_UPDT_CD 
        VARCHAR(1), LST_UPDT_TMP TIMESTAMP, LST_UPDT_USER_ID BIGINT, 
        CUST_EMP_ID VARCHAR(20), HIRED_DATE DATE, JOB_ID BIGINT, 
        JOB_TITLE VARCHAR(50), ORG_ID BIGINT NOT NULL, ORIG_DATA_SRC 
        VARCHAR(15), PART_TIME_FLAG VARCHAR(1), POSITION_TITLE 
        VARCHAR(35), START_DATE DATE, TERM_DATE DATE, EMP_ID BIGINT NOT 
        NULL, PRIMARY KEY (EMPLOYMENT_ID)) 
437  testPersistenceUnit  TRACE  [main] openjpa.jdbc.SQL - <t 109577864,
conn 1115112055> [0 ms] spent
437  testPersistenceUnit  TRACE  [main] openjpa.jdbc.JDBC - <t 109577864,
conn 1115112055> [0 ms] commit
437  testPersistenceUnit  TRACE  [main] openjpa.jdbc.JDBC - <t 109577864,
conn 1115112055> [0 ms] close
453  testPersistenceUnit  TRACE  [main] openjpa.jdbc.JDBC - <t 109577864,
conn 897594752> [16 ms] rollback

484  testPersistenceUnit  TRACE  [main] openjpa.jdbc.SQL - <t 109577864,
conn 1409963018> executing stmnt 307237456 
CREATE INDEX I_MPLYMNT_EMPLOYEE 
    ON EMPLOYMENT (EMP_ID) 
484  testPersistenceUnit  TRACE  [main] openjpa.jdbc.SQL - <t 109577864,
conn 1409963018> [0 ms] spent
484  testPersistenceUnit  TRACE  [main] openjpa.jdbc.JDBC - <t 109577864,
conn 1409963018> [0 ms] close

org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'userDao': Injection of persistence fields failed; nested
exception is <openjpa-1.2.1-SNAPSHOT-r422266:686069 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: Table EMPLOYMENT not
found; SQL statement:
CREATE INDEX I_MPLYMNT_EMPLOYEE ON EMPLOYMENT (EMP_ID) [42102-115] {stmnt
714418837 
CREATE INDEX I_MPLYMNT_EMPLOYEE 
    ON EMPLOYMENT (EMP_ID) } [code=42102, state=42S02]
	at
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessAfterInstantiation(PersistenceAnnotationBeanPostProcessor.java:311)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
	at java.security.AccessController.doPrivileged(AccessController.java:224)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
	at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
	at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
	at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
	at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
	at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:599)
	at
org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:229)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
	at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
	at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:79)
	at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
	at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: <openjpa-1.2.1-SNAPSHOT-r422266:686069 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: Table EMPLOYMENT not
found; SQL statement:
CREATE INDEX I_MPLYMNT_EMPLOYEE ON EMPLOYMENT (EMP_ID) [42102-115] {stmnt
714418837 
CREATE INDEX I_MPLYMNT_EMPLOYEE 
    ON EMPLOYMENT (EMP_ID) } [code=42102, state=42S02]
	at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:553)
	at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:453)
	at
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:159)
	at
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:119)
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:189)
	at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:145)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:56)
	at
org.springframework.orm.jpa.ExtendedEntityManagerCreator.createContainerManagedEntityManager(ExtendedEntityManagerCreator.java:198)
	at
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.resolveExtendedEntityManager(PersistenceAnnotationBeanPostProcessor.java:628)
	at
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement.getResourceToInject(PersistenceAnnotationBeanPostProcessor.java:570)
	at
org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:180)
	at
org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105)
	at
org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessAfterInstantiation(PersistenceAnnotationBeanPostProcessor.java:308)
	... 33 more
Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Table
EMPLOYMENT not found; SQL statement:
CREATE INDEX I_MPLYMNT_EMPLOYEE ON EMPLOYMENT (EMP_ID) [42102-115] {stmnt
714418837 
CREATE INDEX I_MPLYMNT_EMPLOYEE 
    ON EMPLOYMENT (EMP_ID) } [code=42102, state=42S02]
	at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
	at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$700(LoggingConnectionDecorator.java:57)
	at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:762)
	at
org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:114)
	at
org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1191)
	at
org.apache.openjpa.jdbc.schema.SchemaTool.createIndex(SchemaTool.java:1006)
	at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:554)
	at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
	at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
	at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:501)
	... 47 more

I don't see an error when creating the table, but the index won't create.


-- 
View this message in context: http://n2.nabble.com/MappingTool-create-index-fails-tp3290561p3290561.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message