2013-07-29 1 views
0

J'ai ce problème de configuration:Spring-JPA-Hibernate Configuration: la définition de la propriété hiberate.hbm2dll.auto à créer n'a aucun effet?

1) J'ai jpaPropertyMap avec la propriété hibernate.hbm2dll.auto définie pour créer, mais il n'a aucun effet. Il ne crée pas de génération de table SQL.

Je peux voir dans le fichier journal une autre propriété jpaPropertyMap comme le dialecte qui est correctement défini afin que la carte de propriétés soit en cours de lecture.

2) Si la propriété generatedl de HibernateJpaVendorAdapter est définie sur true, la table est générée.

alors pourquoi hibernate.hbm2dll.auto ne fonctionne pas dans les tables de cas/de génération.

Voici le fichier de configuration:

<?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:tx="http://www.springframework.org/schema/tx" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd 
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"> 

    <context:annotation-config /> 
    <context:component-scan base-package="org.demoapps.placementwebsite"/> 

    <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /> 

    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> 
     <property name="driverClassName" value="com.mysql.jdbc.Driver"/> 
     <property name="url" value="jdbc:mysql://localhost:3306/cpm?autoReconnect=true" /> 
     <property name="username" value="user" /> 
     <property name="password" value="password" /> 
    </bean> 

    <bean id="entityManagerFactory" 
     class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> 
     <property name="persistenceUnitName" value="punit" /> 
     <property name="dataSource" ref="dataSource" /> 
     <property name="jpaVendorAdapter"> 
      <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> 
       <property name="showSql" value="true" /> 
      </bean> 
     </property> 

     <property name="jpaPropertyMap"> 
      <map> 
       <entry key="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" /> 
       <entry key="hibernate.hbm2dll.auto" value="create"/> 
       <entry key="hibernate.format_sql" value="true" /> 
      </map> 
     </property> 
    </bean> 

    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> 
     <property name="entityManagerFactory" ref="entityManagerFactory" /> 
    </bean> 

    <tx:annotation-driven transaction-manager="transactionManager" /> 
</beans> 

utilisant: Mise en veille prolongée 4.2.2.Final Spring 3.2.3.RELEASE

Répondre

5

La propriété est hibernate.hbm2ddl.auto, et non hibernate.hbm2dll.auto.

= données Définition DDL Langue

DLL = Dynamic-Link Library

Questions connexes