MyISAM dialect generates wrong DDL

岁酱吖の 提交于 2020-01-14 14:57:47

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!