-->
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.  [ 3 posts ] 
Author Message
 Post subject: SchemaExport and MySQL
PostPosted: Mon Mar 29, 2004 10:22 am 
Newbie

Joined: Thu Mar 25, 2004 2:59 pm
Posts: 6
I am still a bit new to Hibernate but I found some interesting problems when using the SchemaExport tool. I put everything in my property files that I could find in the docs (of course that made sense for my application) that came with Hibernate. I then mapped all my objects and had SchemaExport create the SQL in the MySQL dialect (I made sure to get the dialect correct).

Since it was going to use foreign keys, I figured I would use InnoDB tables since MyISAM tables do not support foreign key constraints. I did not find any option to let me do that with the MySQL dialect. Another problem that I found was that once I created the SQL, there were no semi-colons at end the lines which is required for mysql scripts. MySQL went crazy when I tried to use the schema generated unaltered. Once I got that under control, I am still having problems with a few of the tables. I will do some more investigation before I put anything up here.

My main question is why does the SchemaExport tool not put in semi-colons in the "if table exists" lines at the top of the file and at the end of "create table"? Everything else is coming along well.

The InnoDB thing is probably just a requested enhancement, which I will probably look into if I have the time.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 29, 2004 10:26 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Use InnoDB for all your MySQL tables by default in the MySQL configuration! Otherwise you have a non-transactional file storage, not a database.

End of line delimeters are not needed if the SQL DDL is directly executed in the database by SchemaExport. If you export it to a file, you can set a delimiter with "--delimiter=;" or read the FAQ: http://www.hibernate.org/119.html#A8

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 29, 2004 10:37 am 
Newbie

Joined: Thu Mar 25, 2004 2:59 pm
Posts: 6
Ah. Cool. Thanks! I will take a look at the mysql docs because I really wanted to have them default but I am not sure how to do it (do not worry about answer this for me. I need to figure it out for myself). I have all the stuff in the configuration set for InnoDB. Anyway, thanks for the info and sorry for any inconvienence!

christian wrote:
Use InnoDB for all your MySQL tables by default in the MySQL configuration! Otherwise you have a non-transactional file storage, not a database.

End of line delimeters are not needed if the SQL DDL is directly executed in the database by SchemaExport. If you export it to a file, you can set a delimiter with "--delimiter=;" or read the FAQ: http://www.hibernate.org/119.html#A8


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.