javamysqlhibernateinnodbdialect

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


Solution

  • 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.