2011-12-30 60 views
0

你好,我有一個奇怪的問題。我配置了spring + hibernate。我真的使用註釋配置,但是Hibernate不希望創建我的數據庫結構,當我啓動/重新發布/重新啓動服務器:(冬眠自動創建贏得與春天

這是我的配置,從根本context.xml的

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:context="http://www.springframework.org/schema/context" 
xmlns:mvc="http://www.springframework.org/schema/mvc" 
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd 
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"> 

<!-- Root Context: defines shared resources visible to all other web components --> 

<!-- Datasource configration --> 
<bean id="luxpolDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> 
    <property name="driverClassName" value="com.mysql.jdbc.Driver" /> 
    <property name="url" value="jdbc:mysql://localhost:3306/luxpol" /> 
    <property name="username" value="user" /> 
    <property name="password" value="pass" /> 
</bean> 

<bean id="hibernateSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> 
    <property name="dataSource" ref="luxpolDataSource" /> 
    <property name="packagesToScan" value="com.fixus.luxpol.bean" /> 
    <property name="annotatedClasses"> 
     <list> 
      <value>com.fixus.luxpol.bean.House</value> 
      <value>com.fixus.luxpol.bean.Photo</value> 
     </list> 
    </property> 
    <property name="hibernateProperties"> 
     <props>       
      <prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop> 
      <prop key="hibernate.format_sql">true</prop> 
      <prop key="hibernate.show_sql">true</prop> 
      <prop key="hibernate.hbm2dll.auto">create</prop> 
     </props> 
    </property> 
</bean> 

<mvc:annotation-driven /> 
<context:component-scan base-package="com.fixus.luxpol" /> 
<context:component-scan base-package="com.fixus.luxpol.bean" /> 

我不`噸知道什麼是錯誤的:/

回答

1

該屬性稱爲hbm2ddl.auto,而不是hbm2dll.auto DDL意味着數據定義語言 DLL意味着DYNAM。 ic-Link庫

+0

非常感謝你:)不知道我怎麼會錯過:/ – Fixus 2011-12-30 15:23:47