사용자 도구

사이트 도구


java:hibernate:envers

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
마지막 판 양쪽 다음 판
java:hibernate:envers [2019/06/04 11:03]
kwon37xi
java:hibernate:envers [2020/04/23 16:37]
kwon37xi
줄 4: 줄 4:
   * [[https://spring.io/projects/spring-data-envers|Spring Data Envers]] Hibernate Envers 의 변경 사항을 쉽게 조회할 수 있게 해준다.   * [[https://spring.io/projects/spring-data-envers|Spring Data Envers]] Hibernate Envers 의 변경 사항을 쉽게 조회할 수 있게 해준다.
  
-====== REV 를 long 으로 변경해야한다 ======+===== REV 를 long 으로 변경해야한다 =====
   * 이력이 쌓일 때 이력의 값을 ''REV''라는 컬럼으로 저장하는데 이 값이 ''int'' 타입이다.   * 이력이 쌓일 때 이력의 값을 ''REV''라는 컬럼으로 저장하는데 이 값이 ''int'' 타입이다.
   * 이 경우 약 20억 이상의 이력이 쌓이면 곧바로 오류가 발생하게 된다.   * 이 경우 약 20억 이상의 이력이 쌓이면 곧바로 오류가 발생하게 된다.
줄 26: 줄 26:
   * [[https://hibernate.atlassian.net/browse/HHH-6615|[HHH-6615] int type in Revision number - Hibernate JIRA]]   * [[https://hibernate.atlassian.net/browse/HHH-6615|[HHH-6615] int type in Revision number - Hibernate JIRA]]
  
-====== Custom @RevisionEntity ======+===== Custom @RevisionEntity =====
   * ''@RevisionEntity''를 커스터마이징 하여 원하는 데이터를 추가 저장할 수도 있다.   * ''@RevisionEntity''를 커스터마이징 하여 원하는 데이터를 추가 저장할 수도 있다.
   * [[https://thoughts-on-java.org/hibernate-envers-extend-standard-revision/|Hibernate Envers - Extend the standard revision]]   * [[https://thoughts-on-java.org/hibernate-envers-extend-standard-revision/|Hibernate Envers - Extend the standard revision]]
 +
 +===== 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. 
 +
 +  * 관계맺은 엔티티 자체는 audit 하지 않고, join column 값의 변화면 검사하고자 한다면 관계 매핑에 ''@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)'' 사용.
  
 ===== 참조 ===== ===== 참조 =====
줄 35: 줄 40:
   * [[http://www.javabeat.net/hibernate-envers/|Introduction to Hibernate Envers]]   * [[http://www.javabeat.net/hibernate-envers/|Introduction to Hibernate Envers]]
   * [[http://haviyj.tistory.com/40|Spring Boot + Envers로 엔티티 이력관리하기]]   * [[http://haviyj.tistory.com/40|Spring Boot + Envers로 엔티티 이력관리하기]]
 +  * [[https://mayaul.github.io//envers/|hibernate envers 사용하기 – Mayaul]]
java/hibernate/envers.txt · 마지막으로 수정됨: 2021/04/29 16:53 저자 kwon37xi