Relationship error between tables when implementing audit with Hibernate Envers

0

I'm inserting auditing into my application using Hibernate Envers , but I'm encountering the following error when I use Postgres .

Error:

  

Caused by: liquibase.exception.MigrationFailedException: Migration   failed for change set grp / db / changelogs / changelog-0.1.0.xml :: 0.1.0 ::        Reason: liquibase.exception.DatabaseException: ERROR: relation "public.REVINFO_REV_seq" does not exist [Failed SQL: alter sequence   public. "REVINFO_REV_seq" start with 1] at   liquibase.changelog.ChangeSet.execute (ChangeSet.java:605) at   liquibase.changelog.visitor.UpdateVisitor.visit (UpdateVisitor.java:51)     at   liquibase.changelog.ChangeLogIterator.run (ChangeLogIterator.java:79)     at liquibase.Liquibase.update (Liquibase.java:214) at   liquibase.Liquibase.update (Liquibase.java:192) at   liquibase.Liquibase.update (Liquibase.java:188) at   liquibase.Liquibase.update (Liquibase.java:181) at   br.eti.clairton.migrator.MigratorDefault.run (MigratorDefault.java:103)     ... 36 more Caused by: liquibase.exception.DatabaseException: ERROR:   relation "public.REVINFO_REV_seq" does not exist [Failed SQL: alter   sequence public. "REVINFO_REV_seq" start with 1] at   jib.executor.jvm.JdbcExecutor $ ExecuteStatementCallback.doInStatement (JdbcExecutor.java:301)     at liquibase.executor.jvm.JdbcExecutor.execute (JdbcExecutor.java:55)     at liquibase.executor.jvm.JdbcExecutor.execute (JdbcExecutor.java:107)     at   liquibase.database.AbstractJdbcDatabase.execute (AbstractJdbcDatabase.java:1273)     at   liquibase.database.AbstractJdbcDatabase.executeStatements (AbstractJdbcDatabase.java:1255)     at liquibase.changelog.ChangeSet.execute (ChangeSet.java:568) ... 43   more

Liquibase ChangeSet:

     <-- Tabela de Revisao -->
     <createTable tableName="REVINFO">
        <column name="REV" type="bigint" autoIncrement="true" startWith="1" incrementBy="1">
            <constraints primaryKey="true" primaryKeyName="REV_pkey"/>
        </column>
        <column name="REVTSTMP" type="bigint"/>
    </createTable>

    <-- Entidade Contas -->
    <createTable tableName="contas">
        <column name="id" type="bigint" autoIncrement="true" incrementBy="1">
            <constraints primaryKey="true" primaryKeyName="conta_pkey"
                uniqueConstraintName="conta_id" nullable="false" />
        </column>
        <column name="agencia" type="bigint">
          <constraints nullable="true"/>
        </column>
        <column name="nome" type="varchar(50)">
            <constraints nullable="false" />
        </column>
    </createTable>

    <-- Auditoria Entidade Contas -->
    <createTable tableName="contas_aud">
        <column name="id" type="bigint" autoIncrement="true" incrementBy="1">
            <constraints primaryKey="true"/>
        </column>
        <column name="agencia" type="bigint"/>
        <column name="nome" type="varchar(50)"/>
        <column name="REVTYPE" type="tinyint"/>
        <column name="REV" type="bigint"/>
    </createTable>

Entity Accounts:

    @Entity
    @Audited
    @Table(name = "contas")
    public class Conta extends Model {
        private static final long serialVersionUID = 1L;

        @NotNull
        private Integer agencia;

        @NotNull
        @Size(min=1, max=50)
        private String nome;
    }
    
asked by anonymous 18.04.2018 / 19:14

0 answers