问题
We use the MyISAM dialect org.hibernate.dialect.MySQLMyISAMDialect
to auto generate DDL files based on JPA2 using 3.6.9.Final
hibernate provider on a MySQL 5.5 database.
The create SQL file gets generated as
CREATE TABLE t (i INT) type = MYISAM;
instead of
CREATE TABLE t (i INT) ENGINE = MYISAM;
which causes table creation to fail.
Note: This worked fine in 5.1 and lesser versions. What hibernate provider should I use to get this fixed.
回答1:
It is broken, MySQL dropped support for deprecated "type=" long time ago. There is no working implementation included to Hibernate in the case of MyISAM. For InnoDB there is separate implementation (MySQL5InnoDBDialect).
You have to implement it by yourself, or just pick existing implementation like: http://code.google.com/p/snofyre/source/browse/trunk/snomed-osgi/uk.nhs.cfh.dsp.snomed.persistence/src/main/java/uk/nhs/cfh/dsp/snomed/persistence/orm/MySQL5MyISAMDialect.java
I guess using InnoDB is not option for you? Especially because of lack of transactions MyISAM is not well fitting together with JPA.
来源:https://stackoverflow.com/questions/8666269/myisam-dialect-generates-wrong-ddl