lundi 20 avril 2015

Audit tables not created

I am trying to use hibernate envers to audit particular tables. Here is the version I use:

<dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>4.2.0.Final</version>
        </dependency>
<dependency>  <groupId>org.hibernate</groupId>
            <artifactId>hibernate-envers</artifactId>
            <version>4.0.1.Final</version>
</dependency>

As far as I understand the only thing I have to do is to add @Audited annotation on my entity class.

@Entity
@Audited
@Table(name = "terminal")
public class Terminal {

@Id
    @Column(name = "terminal_id")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "user_id")
    @SequenceGenerator(name = "user_id", sequenceName = "user_id")
    private Long terminalId;
    ...
}

Here is my hibernate.cfg.xml:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://ift.tt/UNuKEc" >
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
        <property name="hibernate.showSql">true</property>
        <property name="hbm2ddl.auto">auto</property>
        <mapping class="com.terminal.domain.Terminal"/>
        ...
    </session-factory>

</hibernate-configuration>

However, terminal_aud table has not been created after my application start.

What do I wrong?

P.S.

Looks similar to this question:

http://ift.tt/1J2u6Lq

Aucun commentaire:

Enregistrer un commentaire