Search code examples
javamysqlhibernatejpainnodb

Hibernate: Create Mysql InnoDB tables instead of MyISAM


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


Solution

  • Can't you specify the Hibernate dialect and use

    hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
    

    Edit

    From MySQL version > 5.1 this should be

    hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
    

    to avoid running into this issue Using "TYPE = InnoDB" in MySQL throws exception