While trying to recreate my database using Hibernate + Spring, the SQL that get's generated appends "type=InnoDB"
to the end of each creation statement. This seems to cause problems with my MySQL5.5.9 setup. It produces the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'type=InnoDB' at line 1
If I manually remove the type=InnoBD and paste the create command in MySQL, it works fine.
Has someone else come across this error? Is it maybe just a MySQL setting that I need to change? I am using the my-innodb-heavy-4G.cnf
template as my /etc/my.cnf
.
I also know that the type
syntax has been deprecated by MySQL, and that engine
should be used (and it does if I manually alter the create statements). Is there any way to configure this in Hibernate?
Thanks
Use MySQL5InnoDBDialect
instead of MySQLInnoDBDialect
.
Using 'MySQL5InnoDBDialect' works with 5.1 and 5.5.
In Grails:
Change the dialect statement in DataSource.groovy
Example:
Use "dialect=org.hibernate.dialect.MySQL5InnoDBDialect" instead of "dialect=org.hibernate.dialect.MySQLInnoDBDialect"
You can use the same approach for your project i guess.
Thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With