簡體   English   中英

Hibernate JPA 創建表類型=InnoDB 問題

[英]Hibernate JPA create table type=InnoDB Problem

我在 JBoss 上部署了一個帶有一些實體類的 EJB 項目。

一旦我部署 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....

不應該是engine=InnoDB而不是 type 嗎? 我試圖在 mysql 中執行此語句,但沒有運氣(同樣的錯誤)。 如果我用引擎刪除或替換類型,它正在工作。

我的問題是,我可以改變誰?

這是我的持久性。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>

如果數據源 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>

謝謝你的幫助。

豪克

請改用MySQL5InnoDBDialect

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM