Creating MySQL InnoDB Tables with Hibernate
When utilizing Hibernate with JPA, you may encounter the need to create MySQL tables with the InnoDB engine instead of the default MyISAM. To achieve this dynamically and not through SQL file generation, consider the following solution:
Solution:
Specify the Hibernate dialect using the property:
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
For MySQL versions greater than 5.1, use:
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
By setting this dialect, Hibernate will automatically create tables with the InnoDB engine, ensuring the desired storage properties and improved performance.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3