Hibernate不会生成表审计

时间:2014-03-31 04:27:39

标签: spring-mvc hibernate-envers

我遇到了Envers的问题,没有工作,没有生成表格。

我使用的是版本:

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>5.0.1.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-commons-annotations</artifactId>
        <version>3.3.0.ga</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-annotations</artifactId>
        <version>3.3.1.GA</version>
    </dependency>

   <dependency>    
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.1.4.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.1.4.Final</version>
    </dependency>

  <dependency>
     <groupId>org.hibernate</groupId>
     <artifactId>hibernate-envers</artifactId>
     <version>4.1.9.Final</version>
   </dependency>

和Spring版本:3.2.6.RELEASE

我的db config:

<context:component-scan base-package="pl.com.web.service" />
<context:property-placeholder
    location="classpath:pl/com/web/config/jdbc.properties" />

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
    destroy-method="close" p:driverClassName="${jdbc.driverClassName}"
    p:url="${jdbc.databaseurl}" p:username="${jdbc.username}" p:password="${jdbc.password}" />

<bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="packagesToScan">
        <list>
            <value>pl.com.web.model</value>
        </list>
    </property>

    <property name="configurationClass">
        <value>org.hibernate.cfg.AnnotationConfiguration</value>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">${jdbc.dialect}</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.hbm2ddl.auto">update</prop>
        </props>
    </property>

</bean>

<tx:annotation-driven transaction-manager="transactionManager"
    proxy-target-class="true" />
<bean id="transactionManager"
    class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
</bean>

<bean id="exceptionTranslator"
    class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor">
</bean>

在版本4+中不需要为envers添加监听器? 并且我向我的实体添加注释@Audited,它不起作用。问题在哪里?

0 个答案:

没有答案