Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Alter table doesn't find table previously created during DDL

All,

I vaguely remember having configured properties for hibernate in the EntityManagerFactory. So I moved the settings you indicated in the spring config.  Things seem to behave slightly differently when I configuring the properties you mention to put  in persistence.xml in the spring configuration.  (More logging (finest), so the settings take only if I put in string config )  However I still have a failure on altering tables and the tables DO NOT exist.

I realize the tomcat logs don't show the info stuff I see on the console.
Anyhow, I will attach my spring config. 

Has anyone gotten spring & eclipselink & ddl generation working together?  Any examples or other ideas?  Likely something silly I am not doing. 


[EL Info]: 2008.09.03 12:22:20.217--ServerSession(18560421)--Thread(Thread[main,5,main])--EclipseLink, version: Eclipse Persistence Services - 1.1 (B
ild SNAPSHOT-20080901)
[EL Config]: 2008.09.03 12:22:21.842--ServerSession(18560421)--Connection(5262695)--Thread(Thread[main,5,main])--connecting(DatabaseLogin(
        platform=>DerbyPlatform
        user name=> ""
        connector=>JNDIConnector datasource name=>null
))
[EL Config]: 2008.09.03 12:22:26.061--ServerSession(18560421)--Connection(4052150)--Thread(Thread[main,5,main])--Connected: jdbc:derby://localhost:15
7/digitalart;create=true
        User: APP
        Database: Apache Derby  Version: 10.4.1.3 - (648739)
        Driver: Apache Derby Network Client JDBC Driver  Version: 10.4.1.3 - (648739)
[EL Config]: 2008.09.03 12:22:26.061--ServerSession(18560421)--Connection(22549381)--Thread(Thread[main,5,main])--connecting(DatabaseLogin(
        platform=>DerbyPlatform
        user name=> ""
        connector=>JNDIConnector datasource name=>null
))
[EL Config]: 2008.09.03 12:22:26.061--ServerSession(18560421)--Connection(23700826)--Thread(Thread[main,5,main])--Connected: jdbc:derby://localhost:1
27/digitalart;create=true
        User: APP
        Database: Apache Derby  Version: 10.4.1.3 - (648739)
        Driver: Apache Derby Network Client JDBC Driver  Version: 10.4.1.3 - (648739)
[EL Finest]: 2008.09.03 12:22:26.170--ServerSession(18560421)--Thread(Thread[main,5,main])--sequencing connected, state is Preallocation_Transaction_
oAccessor_State
[EL Finest]: 2008.09.03 12:22:26.170--ServerSession(18560421)--Thread(Thread[main,5,main])--sequence : preallocation size 50
[EL Finest]: 2008.09.03 12:22:26.170--ServerSession(18560421)--Thread(Thread[main,5,main])--sequence SEQ_GEN: preallocation size 50
[EL Info]: 2008.09.03 12:22:26.327--ServerSession(18560421)--Thread(Thread[main,5,main])--file:/C:/development/apache-tomcat-6.0.14/webapps/DigitalAr
Web/WEB-INF/lib/da-db-0.0.1-SNAPSHOT.jar-DigitalArtJPA login successful
[EL Finest]: 2008.09.03 12:22:26.577--ServerSession(18560421)--Thread(Thread[main,5,main])--Execute query DataModifyQuery()
[EL Finest]: 2008.09.03 12:22:26.592--ServerSession(18560421)--Thread(Thread[main,5,main])--reconnecting to external connection pool
[EL Fine]: 2008.09.03 12:22:26.592--ServerSession(18560421)--Connection(23310932)--Thread(Thread[main,5,main])--CREATE TABLE AUDITLOG (ID BIGINT NOT
ULL, USERNAME VARCHAR(255), SESSIONID VARCHAR(255), ACTION VARCHAR(255), MESSAGE VARCHAR(255), IP VARCHAR(255), USERAGENT VARCHAR(255), TIMESTAMP TIM
STAMP, PRIMARY KEY (ID))
[EL Finest]: 2008.09.03 12:22:27.030--Thread(Thread[main,5,main])--The table (AUDITLOG) is created.

[EL Fine]: 2008.09.03 12:22:39.733--ServerSession(18560421)--Connection(16233020)--Thread(Thread[main,5,main])--CREATE TABLE RATING (ID BIGINT NOT NUL
L, VALUE INTEGER, CONTAINER_ID BIGINT, USERWHOVOTED_ID BIGINT, PRIMARY KEY (ID))
[EL Finest]: 2008.09.03 12:22:40.170--Thread(Thread[main,5,main])--The table (RATING) is created.
[EL Finest]: 2008.09.03 12:22:40.170--ServerSession(18560421)--Thread(Thread[main,5,main])--Execute query DataModifyQuery()
[EL Finest]: 2008.09.03 12:22:40.170--ServerSession(18560421)--Thread(Thread[main,5,main])--reconnecting to external connection pool
[EL Fine]: 2008.09.03 12:22:40.170--ServerSession(18560421)--Connection(25626423)--Thread(Thread[main,5,main])--CREATE TABLE FORUM (ID BIGINT NOT NULL
, NAME VARCHAR(255), GALLERY_ID BIGINT, IMAGE_ID BIGINT, PRIMARY KEY (ID))
[EL Finest]: 2008.09.03 12:22:40.498--Thread(Thread[main,5,main])--The table (FORUM) is created.
[EL Finest]: 2008.09.03 12:22:40.498--ServerSession(18560421)--Thread(Thread[main,5,main])--Execute query DataModifyQuery()
[EL Finest]: 2008.09.03 12:22:40.498--ServerSession(18560421)--Thread(Thread[main,5,main])--reconnecting to external connection pool
[EL Fine]: 2008.09.03 12:22:40.498--ServerSession(18560421)--Connection(26133207)--Thread(Thread[main,5,main])--ALTER TABLE GROUPS_GROUPS ADD CONSTRAI
NT GRUPSGROUPSGroupID FOREIGN KEY (Group_ID) REFERENCES GROUPS (ID)
[EL Fine]: 2008.09.03 12:22:40.733--ServerSession(18560421)--Thread(Thread[main,5,main])--VALUES(1)
[EL Warning]: 2008.09.03 12:22:40.811--ServerSession(18560421)--Thread(Thread[main,5,main])--Exception [EclipseLink-4002] (Eclipse Persistence Service
s - 1.1 (Build SNAPSHOT-20080901)): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: 'ALTER TABLE' cannot be performed on 'GROUPS_GROUPS' because it does not exist.
Error Code: -1
Call: ALTER TABLE GROUPS_GROUPS ADD CONSTRAINT GRUPSGROUPSGroupID FOREIGN KEY (Group_ID) REFERENCES GROUPS (ID)
Query: DataModifyQuery()
[EL Finest]: 2008.09.03 12:22:40.842--ServerSession(18560421)--Thread(Thread[main,5,main])--Execute query DataModifyQuery()
[EL Finest]: 2008.09.03 12:22:40.842--ServerSession(18560421)--Thread(Thread[main,5,main])--reconnecting to external connection pool



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
	xmlns:aop="http://www.springframework.org/schema/aop"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	xmlns:context="http://www.springframework.org/schema/context";
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
      http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
      
      http://www.springframework.org/schema/aop 
      http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd";>

	<bean id="eclipseLinkJPAProperties"
		class="org.springframework.beans.factory.config.PropertiesFactoryBean">
		<property name="properties">
			<props>
				<prop key="eclipselink.logging.level">FINEST</prop>
				<prop key="eclipselink.ddl-generation">create-tables</prop>
				<prop key="eclipselink.ddl-generation.output-mode">database</prop>
				
			</props>
		</property>
	</bean>

	<bean id="jpaAdapter"
		class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
		<property name="databasePlatform"
			value="org.eclipse.persistence.platform.database.DerbyPlatform" >
			</property>
			<property name="generateDdl" value="true"></property>
			<property name="showSql" value="true"></property>
	</bean>
	<bean id="jpaDialect"
		class="org.springframework.orm.jpa.vendor.EclipseLinkJpaDialect">
	</bean>
	<bean id="entityManagerFactory"
		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
		<property name="dataSource" ref="daDataSource" />
		<property name="persistenceUnitName" value="DigitalArtJPA" />
		<property name="jpaDialect" ref="jpaDialect" />
		<property name="jpaVendorAdapter" ref="jpaAdapter" />
		<property name="jpaProperties" ref="eclipseLinkJPAProperties"></property>
		
	</bean>
	<aop:aspectj-autoproxy />
	<context:spring-configured />
	<context:load-time-weaver weaver-class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver" aspectj-weaving="autodetect"/>
</beans>
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence";
	version="1.0">
	<persistence-unit name="DigitalArtJPA"
		transaction-type="RESOURCE_LOCAL">
		<class>da.db.model.ArtCategory</class>
		<class>da.db.model.ArtMovement</class>
		<class>da.db.model.AuditLog</class>
		<class>da.db.model.Buyer</class>
		<class>da.db.model.CartItem</class>
		<class>da.db.model.Commission</class>
		<class>da.db.model.DigitalContent</class>
		<class>da.db.model.DigitalItem</class>
		<class>da.db.model.DigitalItemTag</class>
		<class>da.db.model.Forum</class>
		<class>da.db.model.Gallery</class>
		<class>da.db.model.GalleryTag</class>
		<class>da.db.model.Group</class>
		<class>da.db.model.Post</class>
		<class>da.db.model.Price</class>
		<class>da.db.model.Rating</class>
		<class>da.db.model.RatingAggregate</class>
		<class>da.db.model.RatingContainer</class>
		<class>da.db.model.RememberMe</class>
		<class>da.db.model.Seller</class>
		<class>da.db.model.User</class>
		
	</persistence-unit>
</persistence>

Back to the top