springspring-boothibernatehibernate-envers

Hibernate envers hibernate_sequence cannot be found in schema


Im trying to use hibernate envers..

I have tables annotated with @Audited, but problem occurs with hibernate_sequence..

CREATE SEQUENCE IF NOT EXISTS custom_schema.hibernate_sequence START 1 INCREMENT 1;

So Im using custom_schema and obviously problem is

ERROR: relation "hibernate_sequence" does not exist

So Im asking if it is possible to somehow tell hibernate in which schema this sequence is?


Solution

  • Ok, solved by creating own revisionentity

    @RevisionEntity
    @Entity
    @Table(name = "revinfo", schema = "custom_schema")
    class RevInfo (
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @RevisionNumber
        var id: Long? = null,
    
        @RevisionTimestamp
        var timestamp: Long = 0
    )