2011-08-17 60 views
7

私はいくつかのエンティティクラスを持つJBossにEJBプロジェクトをデプロイしました。できるだけ早く私は、EJB JBossの展開としてHibernate JPA create table type = InnoDB問題

は私にこの例外を与える:

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.... 

はそれではなく、タイプのエンジン= InnoDBのではないでしょうか?私は運がない(同じエラー)mysqlでこの文を実行しようとしました。エンジンでタイプを取り除いたり交換したりしていれば、それは動作しています。

私の質問は、誰に変更できますか?あなたの助けのための

<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> 

ありがとう:

は、ここで(それが重要である場合には)私のpersistance.xml

とデータソースの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> 
です。

Hauke

+0

複製:http://stackoverflow.com/questions/5231325/mysql-5-5-9-and-hibernate-table-creation-error-on-type – Vlad

答えて

34

利用代わりにMySQL5InnoDBDialect

+6

org.hibernateを簡単にコピー&ペーストするためです。 dialect.MySQL5InnoDBDialect' –

+0

おかげで、私は解決しました。 –

+0

@deprecated代わりに "hibernate.dialect.storage_engine = innodb"環境変数またはJVMシステムプロパティを使用してください。 – slim