このコンテンツは選択した言語では利用できません。
12.7.4. Getting Started with Entity Auditing
12.7.4.1. Add Auditing Support to a JPA Entity リンクのコピーリンクがクリップボードにコピーされました!
リンクのコピーリンクがクリップボードにコピーされました!
JBoss EAP 6 uses entity auditing, through Section 12.7.1, “About Hibernate Envers”, to track the historical changes of a persistent class. This topic covers adding auditing support for a JPA entity.
Procedure 12.8. Add Auditing Support to a JPA Entity
- Configure the available auditing parameters to suit the deployment: Section 12.7.5.1, “Configure Envers Parameters”.
- Open the JPA entity to be audited.
- Import the
org.hibernate.envers.Auditedinterface. - Apply the
@Auditedannotation to each field or property to be audited, or apply it once to the whole class.Example 12.30. Audit Two Fields
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example 12.31. Audit an entire Class
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Result
The JPA entity has been configured for auditing. A table called Entity_AUD will be created to store the historical changes.