O hbm2ddl.auto não está sendo executado

1 resposta
darksteel3000

Olá amigos, tenho uma aplicação com spring e hibernate, no meu arquivo setei todas as propriedades do hibernate, inclusive a do hbm2ddl.auto ;

Mas ao iniciar o contexto do spring, ele não executa a criação/atualização das tabelas.

Como resolver?

Meu applicationContext:

<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
 
<bean id="dataSource" 
         class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="org.postgresql.Driver" />
        <property name="url" value="jdbc:postgresql://localhost:5432/***" />
        <property name="username" value="***" />
        <property name="password" value="***" />
</bean>

       <!-- Hibernate session factory -->
        <bean id="sessionFactory"
                class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">

<!-- Configura o DataSource -->
                <property name="dataSource">
                        <ref bean="dataSource" />
                </property>

<!-- Propriedade do Hibernate -->
                <property name="hibernateProperties">
                        <props>
                                <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
                                <prop key="hibernate.show_sql">true</prop>
                                <prop key="hibernate.format_sql">true</prop>
                                <prop key="hibernate.c3p0.min_size">5</prop>
                                <prop key="hibernate.c3p0.max_size">100</prop>
                                <prop key="hibernate.c3p0.timeout">1800</prop>
                                <prop key="hibernate.c3p0.max_statements">50</prop>
                                <prop key="hibernate.hbm2dll.auto">update</prop>
                                <prop key="hibernate.c3p0.idle_test_period">3000</prop>
                        </props>
                </property>

<!-- Local para varrer todas as minhas entidades anotadas -->
                <property name="packagesToScan" value="br.com.***.model"/>
        </bean>
        
         <!-- Auto scan the components -->
         <context:component-scan base-package="br.com.***"/>
         	
         	<context:annotation-config />

</beans>

1 Resposta

rogelgarcia

hibernate.hbm2dll.auto está escrito errado …

hibernate.hbm2ddl.auto=update

Criado 23 de fevereiro de 2013
Ultima resposta 23 de fev. de 2013
Respostas 1
Participantes 2