-1

I went to the documentation (http://docs.jboss.org/envers/docs/#revisionlog) there it was written that if we annonate an entity with @RevisionEntity then Hibernate will not create default revinfo table by its own instead it will map the entity which is annotated with @RevisionEntity. I tried still its createing default table named as revinfo and not custom named table as RevisionTable. Following is the code :


import javax.persistence.GeneratedValue;
import javax.persistence.Id;

import org.hibernate.envers.RevisionEntity;
import org.hibernate.envers.RevisionNumber;
import org.hibernate.envers.RevisionTimestamp;


@RevisionEntity

public class RevisionTable   {


@Id
@GeneratedValue
@RevisionNumber
private int id;

@RevisionTimestamp
private long timestamp;

public int getId() {
    return id;
}

public void setId(int id) {
    this.id = id;
}

public long getTimestamp() {
    return timestamp;
}

public void setTimestamp(long timestamp) {
    this.timestamp = timestamp;
}


}

I am not understanding where i am going wrong. As i am new to Hibernate Envers, it will be helpfull if explain the solution in detail.

aeroboy
  • 149
  • 4
  • 14

1 Answers1

3

Your revision entity needs to also contain these annotations:

@Entity
@Table(name="REVISIONS_TABLE_NAME")

and it needs to be scanned by hibernate like any other entity. Please refer to the documentation, this was specified there: http://docs.jboss.org/envers/docs/

SergeiBednar
  • 370
  • 1
  • 10