Sonu Agarwal
Sonu Agarwal

Reputation: 117

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?

Upvotes: 0

Views: 57

Answers (1)

BValluri
BValluri

Reputation: 956

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.

Upvotes: 0

Related Questions