views:

1166

answers:

2

How can I get Hibernate (using JPA) to create MySQL InnoDB tables (instead of MyISAM)? I have found solutions that will work when using Hibernate to generate an SQL file to create the tables, but nothing that works "on the fly".

+4  A: 

Can't you specify the Hibernate dialect and use org.hibernate.dialect.MySQLInnoDBDialect

Pascal Thivent
That did the job! Thanks!
David Tinker
+2  A: 

Are you specifying the dialect setting in your hibernate configuration? If not, then Hibernate will attempt to auto-detect the database dialect, and will choose the safest MySQL dialec, which is MySQL 4 MyISAM.

You can give it a specific dialect, by adding this to your hibernate properties:

hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
skaffman
Yes we had the MySQL5Dialect set. Thanks for the tip!
David Tinker