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.