-->
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.  [ 2 posts ] 
Author Message
 Post subject: SchemaExport did not successfully create fk constraints
PostPosted: Sat Jul 03, 2010 3:53 pm 
Newbie

Joined: Wed Apr 25, 2007 9:41 pm
Posts: 4
Hi,
I am currently upgrading my sample project, which was created 3 years ago, to latest version of frameworks, such as Hibernate, Jboss Cache, and Spring.
The issue I am encountering is the SchemaExport did not create foreign key constraints into Mysql when
I am deploying the application on Ubuntu.
I remembered it was generated successfully when I worked on Windows 3 years ago.
so I switch to Windows again and deploy the same application, ah! it got created successfully.
(Verified by all kinds of DB clients: NetBeans built-in DB browers, mysql administrator)

So I collected the log files of the server (Glassfish 3.0.1) from both platforms,
the result is the parts of hbm2ddl.SchemaExport in both log files are almost the same, such as the key part (only the time stamp is different showing in diff):

Code:
INFO: 2010-07-04 03:28:38,051 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport] (FelixStartLevel:)
    alter table Orders
        add index FK8D444F05D1AABBE (userId),
        add constraint FK8D444F05D1AABBE
        foreign key (userId)
        references User (userId)


So I am wondering where the problem is,
the jdbc driver? but the version are set in the pom file:

Code:
        <spring.version>3.0.3.RELEASE</spring.version>
        <hibernate.version>3.5.3-Final</hibernate.version>
        <mysql-connectorj.version>5.1.13</mysql-connectorj.version>
        <c3p0.version>0.9.1.2</c3p0.version>
        <log4j.version>1.2.15</log4j.version>
        <jbosscache-core-version>3.2.5.GA</jbosscache-core-version>
        <aspectj.version>1.6.8</aspectj.version>
        <org.slf4j-version>1.6.0</org.slf4j-version>



Hope someone can help me out.

Thanks,
Pprun


Update:
the version for mysql is:
Code:
Server version: 5.1.37-1ubuntu5.4 (Ubuntu)


Top
 Profile  
 
 Post subject: Re: SchemaExport did not successfully create fk constraints
PostPosted: Sun Jul 04, 2010 4:11 am 
Newbie

Joined: Wed Apr 25, 2007 9:41 pm
Posts: 4
I found the root cause is the store engine configuration of mysql on working Linux Box, default is 'MyISAM',
after switch to 'INNODB', this issue has been gone:

Code:
set global storage_engine=INNODB



- Pprun


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

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.