简体   繁体   中英

How can I configure Hibernate 5 to force Mysql create tables using Innodb engine?

Spent several hours to solve this issue, gave up finally. I need my app to create Innodb tables, but by default they are created in Myisam engine. I've tried to set property,

<property name="hibernate.dialect.storage_engine">innodb</property> but it won't work.

org.hibernate.dialect.MySQL57InnoDBDialect - deprecated

Found out there is org.hibernate.dialect.InnoDBStorageEngine class but I couldn't set it to property name="hibernate.dialect" in my hibernate.cfg.xml because of

org.hibernate.dialect.InnoDBStorageEngine' is not assignable to 'org.hibernate.dialect.Dialect

reason. Do you have any idea where I can set InnoDBStorageEngine? Or is there another way to force Hibernate use innodb while creating tables? Thanks in advance

The Hibernate 5.2 documentaton suggests what to do in deprecation description

MySQL57InnoDBDialect - Deprecated

Use "hibernate.dialect.storage_engine=innodb" environment variable or JVM system property instead.

So use org.hibernate.dialect.MySQL57Dialect in combination with this property set.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM