Search code examples
mysqlhibernatehbm2ddl

How can I instruct hbm2ddl to generate sql for MyISAM engine


When I use hbm2ddl commands to auto generate SQL from JPA2 based annotations it automatically creates the table for ENGINE=InnoDB

e.g.
create table foo (id integer not null, bar integer) ENGINE=InnoDB;

What should I do to my JPA model class to generate SQL for ENGINE=MyISAM


Solution

  • We have 3 Dialect in Hibernate for MySQL.

    MySQL org.hibernate.dialect.MySQLDialect 
    MySQL with InnoDB org.hibernate.dialect.MySQLInnoDBDialect 
    MySQL with MyISAM org.hibernate.dialect.MySQLMyISAMDialect 
    

    I guess that would serve the purpose for you.

    Please ask if there is anything else you want or if you find any difficulty in implementing it.