목차

Hibernate Envers

REV 를 long 으로 변경해야한다

@Entity
@RevisionEntity
public class CustomRevisionEntity implements Serializable {
  @Id
  @GeneratedValue
  @RevisionNumber
  private long rev;
  @RevisionTimestamp
  private long timestamp;
  /* provide getter/setters */
}

Custom @RevisionEntity

ToOne 관계의 join column audit

If you want to audit a relation, where the target entity is not audited (that is the case for example with dictionary-like entities, which don't change and don't have to be audited), just annotate it with @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED). Then, when reading historic versions of your entity, the relation will always point to the “current” related entity.

참조