MyISAM方言生成错误的DDL [英] MyISAM dialect generates wrong DDL
问题描述
我们使用MyISAM方言org.hibernate.dialect.MySQLMyISAMDialect
在MySQL 5.5上使用3.6.9.Final
休眠提供程序基于JPA2自动生成DDL文件.
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;
这将导致表创建失败.
注意:在5.1及更低版本中,此方法运行良好.我应该使用哪种休眠提供程序来解决此问题.
Note: This worked fine in 5.1 and lesser versions. What hibernate provider should I use to get this fixed.
推荐答案
很久以前,MySQL放弃了对不赞成使用的"type ="的支持.对于MyISAM,Hibernate没有包含任何有效的实现.对于InnoDB,有单独的实现(MySQL5InnoDBDialect).
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
我猜不适合使用InnoDB吗?尤其是由于缺乏交易,MyISAM与JPA不太适合.
I guess using InnoDB is not option for you? Especially because of lack of transactions MyISAM is not well fitting together with JPA.
这篇关于MyISAM方言生成错误的DDL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!