-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate & MySQL !!!
PostPosted: Mon Jul 10, 2006 1:21 am 
Beginner
Beginner

Joined: Wed May 10, 2006 9:43 pm
Posts: 30
Location: Australia
Hi Everyone,

Recently we changed our tables from MyISAM to InnoDB, we found the foreign keys were not correctly created. I thought this solved the problem. I changed to InnoDB by altering the
<property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>

<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>

from the hibernate.cfg.cml.

Now that we need to load the data ASAP the database tables are not accessible. Within the /data directory only one *.frm file exists for each table. Whereas using MyISAM we had *.frm, *.MYD and *.MYI file extensions for each table.

We are using MySQL 5 within eclipse. I am fairly new to Hibernate and Databases please comment if you can help. If there is something I forgot to change to alter the tables to work correctly with InnoDB please let me now.

This is another small question I have whenever i try to open my database through hibernate configurations (of hibernate tools) it says duplicate mapping exception. But if I take out the mapping files from hibernate.cfg.xml my code won't run. If i block out the mapping files i can see the tables etc. Any suggestions?

Regards, Alyssa.


Top
 Profile  
 
 Post subject: Re: Hibernate & MySQL !!!
PostPosted: Mon Jul 10, 2006 2:31 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
AlyssaK wrote:
I changed to InnoDB by altering the
<property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>

<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>

from the hibernate.cfg.cml.


Did you only do that to convert from isam to innodb : change the dialect ? If yes, I'd say it's totally normal... Doing this is not converting your db, you must do this from the mysql admin console. Here, you're just saying to Hibernate that the db is an innodb one, but, if you didn't convert from mysql directly, it's not.

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject: convert to innoDB
PostPosted: Mon Jul 10, 2006 3:54 am 
Beginner
Beginner

Joined: Wed May 10, 2006 9:43 pm
Posts: 30
Location: Australia
Thanks for your reply!!

Is this an example? [url]http://software.newsforge.com/article.pl?sid=05/07/13/1513211&tid=72
[/url]

I checked the database and the default storage engine is set to InnoDB.

I also noticed within my my.ini there is a line #skip-innodb, could this be causing my problems?

SO in summary I haven't been able to get my foreign keys working when setting the dialect to MySQLMyISAMDialect. When I set the dialect to MySQLInnoDBDialect foreign keys okay but i don't get all the database files for each table ONLY the *.frm files as mentioned previously.

The database type is a multifunctional database.

Please offer suggestions if you can help, this trivial problem is irritating!

Regards, Alyssa.


Top
 Profile  
 
 Post subject: InnoDB
PostPosted: Fri Jul 14, 2006 4:06 am 
Beginner
Beginner

Joined: Wed May 10, 2006 9:43 pm
Posts: 30
Location: Australia
I recently found out that this is okay, the InnoDB engine only requires a .FRM file for each table and one ibdata file. Another database backup file was created and dumped into the database it and worked.


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