java Hibernate JPA 创建表类型=InnoDB 问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7090835/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Hibernate JPA create table type=InnoDB Problem
提问by Hauke
I have an EJB Project deployed on JBoss with some entity classes.
我在 JBoss 上部署了一个带有一些实体类的 EJB 项目。
As soon as I deploy the EJB Jboss gives me this exception:
一旦我部署了 EJB,Jboss 就会给我这个异常:
create table service_db (id integer not null auto_increment, ipAddress varchar(255),
primary key (id)) type=InnoDB
Unsuccessful: create table service_db (id integer not null auto_increment,
ipAddress varchar(255), primary key (id)) type=InnoDB
2011-08-17 11:38:59,997 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'type=InnoDB' at line 1....
Shouldn't it be engine=InnoDBinstead of type? I tried to execute this statement in mysql without luck (same error). If I remove or replace type with engine it is working.
不应该是engine=InnoDB而不是 type 吗?我试图在没有运气的情况下在 mysql 中执行此语句(相同的错误)。如果我用引擎移除或替换类型,它就可以工作。
My question is, who can I change that?
我的问题是,我可以改变谁?
Here is my persistance.xml (in case it is important)
这是我的persistance.xml(以防它很重要)
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="default">
<jta-data-source>java:/DUMMY_DS</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect" />
</properties>
</persistence-unit>
and in case the datasource xml file is important:
如果数据源 xml 文件很重要:
<datasources>
<local-tx-datasource>
<jndi-name>DUMMY_DS</jndi-name>
<connection-url>jdbc:mysql://localhost/cargosoft</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>hauke</user-name>
<password>******</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
<idle-timeout-minutes>10</idle-timeout-minutes>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
</local-tx-datasource>
</datasources>
Thanks for your help.
谢谢你的帮助。
Hauke
豪克
回答by Vlad
Use MySQL5InnoDBDialect
instead.
使用MySQL5InnoDBDialect
来代替。