Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate JPA create table type=InnoDB Problem

I have an EJB Project deployed on JBoss with some entity classes.

As soon as I deploy the EJB Jboss gives me this exception:

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=InnoDB instead 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.

My question is, who can I change that?

Here is my persistance.xml (in case it is important)

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

<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

like image 444
Hauke Avatar asked Aug 17 '11 09:08

Hauke


1 Answers

Use MySQL5InnoDBDialect instead.

like image 155
Vlad Avatar answered Sep 21 '22 07:09

Vlad