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.