I am using Hibernate Envers with entity
@Entity
@Table(name = "users", schema = "core")
@Audited public class Users implements java.io.Serializable, Comparable<Users> {
protected static final long serialVersionUID = 1250157348010696249L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "userid")
protected Integer userId;
@Column(name = "aduserid")
protected String aduserId;
@Column(name = "firstname")
protected String firstName;
@Column(name = "middlename")
i am getting error hibernate sequence does not exist .
when i am changing false then it says revision generator does not exist. Pls help me.
Hibernate Envers provides a very simple solution for CDC (Change Data Capture). It uses the Hibernate Event system to intercept all entity state transitions and audit them. The database transaction will roll back and both the actual changes and the audit log is rolled back.
The Envers module is a core Hibernate model that works both with Hibernate and JPA. In fact, you can use Envers anywhere Hibernate works whether that is standalone, inside WildFly or JBoss AS, Spring, Grails, etc. The Envers module aims to provide an easy auditing / versioning solution for entity classes.
If you use strategy="AUTO" , Hibernate will generate a table called hibernate_sequence to provide the next number for the ID sequence. You may have forgotten to add the AutoIncrement feature to your table's PK.
you need to create hibernate_sequence
in your database,
check sample code
CREATE SEQUENCE hibernate_sequence INCREMENT 1 MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
Hibernate Envers expects a global sequence "hibernate_sequence" in order to insert into the "revinfo" table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With