-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate doesn't create table to InnoDB
PostPosted: Thu Jul 14, 2011 4:13 am 
Newbie

Joined: Thu Jul 14, 2011 4:07 am
Posts: 2
Hi, first sorry for my english.

I'm having a trouble using hbm2ddl.auto, it doesn't create tables using InnoDB.
I'm using MySQL5InnoDBDialect.

I'm Using Mysql 5.0.77
and Hibernate 3.6.5.FINAL

here is my applicationContext.xml
Code:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
      <property name="dataSource" ref="dataSource" />
      <property name="packagesToScan" value="org.sp.domain.entity" />
      <property name="hibernateProperties">
         <props>
            <prop key="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
            <prop key="cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
            <prop key="hibernate.show_sql">false</prop>
            <prop key="hibernate.current_session_context_class">thread</prop>
            <prop key="hibernate.format_sql">true</prop>
            <prop key="hibernate.hbm2ddl.auto">create</prop>
         </props>
      </property>
   </bean>


and here is my hbm2ddl log.
Code:
2011-07-14 17:02:13,132 [ INFO] SchemaExport:234 - Running hbm2ddl schema export
2011-07-14 17:02:13,134 [DEBUG] SchemaExport:252 - import file not found: /import.sql
2011-07-14 17:02:13,135 [ INFO] SchemaExport:262 - exporting generated schema to database
2011-07-14 17:02:13,137 [DEBUG] SchemaExport:415 -
    alter table Comment
        drop
        foreign key FK9BDE863F23DC81AD
2011-07-14 17:02:13,146 [DEBUG] SchemaExport:400 - Unsuccessful: alter table Comment drop foreign key FK9BDE863F23DC81AD
2011-07-14 17:02:13,146 [DEBUG] SchemaExport:401 - Table 'spoon.Comment' doesn't exist
2011-07-14 17:02:13,147 [DEBUG] SchemaExport:415 -
    drop table if exists Comment
2011-07-14 17:02:13,150 [DEBUG] SchemaExport:415 -
    drop table if exists User
2011-07-14 17:02:13,152 [DEBUG] SchemaExport:415 -
    create table Comment (
        id integer not null auto_increment,
        message varchar(255),
        user_userId varchar(255),
        primary key (id)
    )
2011-07-14 17:02:13,157 [DEBUG] SchemaExport:415 -
    create table User (
        userId varchar(255) not null,
        userName varchar(255),
        userpassword varchar(255),
        primary key (userId)
    )
2011-07-14 17:02:13,162 [DEBUG] SchemaExport:415 -
    alter table Comment
        add index FK9BDE863F23DC81AD (user_userId),
        add constraint FK9BDE863F23DC81AD
        foreign key (user_userId)
        references User (userId)
2011-07-14 17:02:13,166 [ INFO] SchemaExport:281 - schema export complete
2011-07-14 17:02:13,292 [DEBUG] SQL:111 -
    insert
    into
        User
        (userName, userpassword, userId)
    values
        (?, ?, ?)



and I'm sure my mysql supports InnoDB
Code:
show variables like 'have_innodb';
Variable_name  Value
have_innodb   YES


Any answer will be pleased.


Top
 Profile  
 
 Post subject: Re: Hibernate doesn't create table to InnoDB
PostPosted: Fri Jul 15, 2011 1:42 am 
Newbie

Joined: Thu Jul 14, 2011 4:07 am
Posts: 2
Oh, It was my mistake. I changed my applicationContext.xml.

this part
Code:
<prop key="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>


to

Code:
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.