简体   繁体   中英

Hibernate Envers Auditing

I am using Hibernate4 with envers for audit logging purposes.

I have a table:

PRODUCTS(PRODUCT_ID(primaryKey),
         PRODUCT_CODE,
         PRODUCE_DESC,
         PRODUCT_FEE)

Hibernate has created an audit table PRODUCTS_AUD .

Whenever there is a change in the Product description, Hibernate is tracking the changes in the previous records.

Some records have only Product_desc changed. Some records have only product_fees changed for a particular Product_id . Is their a way to find out what all the changed fields are between revisions?

Product audit table should log only the changes happens to the product table. So, table structure should be PRODUCT_AUDIT(ID(Primary key),PRODUCT_ID, ATTRIBUTE_NAME, OLD_VALUE, NEW_VALUE) .

Check whether is there any options to change audit table structure. Once you have table design like this, it is easy to find the what are changes happend.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM