-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: problem with hbm2ddl.auto update schema on mysql
PostPosted: Thu Apr 22, 2010 12:45 pm 
Newbie

Joined: Thu Apr 22, 2010 12:13 pm
Posts: 3
Hello,

I'm using hibernate 3.5.0-CR2 with MySQL server 5.1.44 (through mysql-connector-java-5.1.9) on Windows.
I'm using JPA 2.0 and I have hbm2ddl.auto set to update and tables get created okay to start but on subsequent updates where the tables already exist, updates fail as the the tables are not found and an attempt is made to create the tables which already exist.

In MySQL, I have lower_case_table_names=1 (have also tried lower_case_table_names=2 with no success). MySQL server data (information_schema and mysql) are stored in MyISAM while the application data is stored in InnoDB.

On a data source connection, when I call getMetaData().supportsMixedCaseQuotedIdentifiers(), I get false.

I have seen some similar issue on this from a few years back in this forum but the problem seems have been resolved so if someone has insight into how I can get this to work. Please let me know. I have attached log output at the bottom.

Thanks,
Len


09:38:49,945 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] - Running hbm2ddl schema update
09:38:49,945 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] - fetching database metadata
09:38:49,948 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] - updating schema
09:38:49,948 DEBUG [org.hibernate.cfg.AnnotationConfiguration] - Execute first pass mapping processing
09:38:49,948 DEBUG [org.hibernate.cfg.AnnotationConfiguration] - Process hbm files
09:38:49,948 DEBUG [org.hibernate.cfg.AnnotationConfiguration] - Process annotated classes
09:38:49,948 DEBUG [org.hibernate.cfg.AnnotationConfiguration] - processing fk mappings (*ToOne and JoinedSubclass)
09:38:49,948 DEBUG [org.hibernate.cfg.Configuration] - processing extends queue
09:38:49,948 DEBUG [org.hibernate.cfg.Configuration] - processing collection mappings
09:38:49,948 DEBUG [org.hibernate.cfg.Configuration] - processing native query and ResultSetMapping mappings
09:38:49,948 DEBUG [org.hibernate.cfg.Configuration] - processing association property references
09:38:49,949 DEBUG [org.hibernate.cfg.Configuration] - processing foreign key constraints
09:38:49,949 DEBUG [org.hibernate.cfg.Configuration] - resolving reference to class: com.jostleme.jostle.server.domain.User
09:38:49,967 INFO [org.hibernate.tool.hbm2ddl.DatabaseMetadata] - table not found: Customer
09:38:49,967 DEBUG [org.hibernate.id.factory.DefaultIdentifierGeneratorFactory] - Setting dialect [org.hibernate.dialect.MySQLDialect]
09:38:49,969 INFO [org.hibernate.tool.hbm2ddl.DatabaseMetadata] - table not found: User
09:38:49,969 DEBUG [org.hibernate.id.factory.DefaultIdentifierGeneratorFactory] - Setting dialect [org.hibernate.dialect.MySQLDialect]
09:38:49,970 INFO [org.hibernate.tool.hbm2ddl.DatabaseMetadata] - table not found: Customer
09:38:49,972 INFO [org.hibernate.tool.hbm2ddl.DatabaseMetadata] - table not found: User
09:38:49,972 DEBUG [org.hibernate.id.factory.DefaultIdentifierGeneratorFactory] - Setting dialect [org.hibernate.dialect.MySQLDialect]
09:38:49,973 DEBUG [org.hibernate.id.factory.DefaultIdentifierGeneratorFactory] - Setting dialect [org.hibernate.dialect.MySQLDialect]
09:38:49,973 DEBUG [org.hibernate.tool.hbm2ddl.SchemaUpdate] - create table Customer (id bigint not null auto_increment, email varchar(255), firstName varchar(255), lastModifiedTime datetime, lastName varchar(255), user_id bigint, primary key (id))
09:38:49,974 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] - Unsuccessful: create table Customer (id bigint not null auto_increment, email varchar(255), firstName varchar(255), lastModifiedTime datetime, lastName varchar(255), user_id bigint, primary key (id))
09:38:49,974 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] - Table 'customer' already exists
09:38:49,974 DEBUG [org.hibernate.tool.hbm2ddl.SchemaUpdate] - create table User (id bigint not null auto_increment, mustChangePassword bit, password varchar(255), role varchar(255), username varchar(255), primary key (id))
09:38:49,975 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] - Unsuccessful: create table User (id bigint not null auto_increment, mustChangePassword bit, password varchar(255), role varchar(255), username varchar(255), primary key (id))
09:38:49,975 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] - Table 'user' already exists
09:38:49,975 DEBUG [org.hibernate.tool.hbm2ddl.SchemaUpdate] - alter table Customer add index FK27FBE3FE597C3B3E (user_id), add constraint FK27FBE3FE597C3B3E foreign key (user_id) references User (id)
09:38:50,000 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] - Unsuccessful: alter table Customer add index FK27FBE3FE597C3B3E (user_id), add constraint FK27FBE3FE597C3B3E foreign key (user_id) references User (id)
09:38:50,000 ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] - Duplicate key name 'FK27FBE3FE597C3B3E'
09:38:50,000 INFO [org.hibernate.tool.hbm2ddl.SchemaUpdate] - schema update complete


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.