0

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?

Nathaniel Ford
  • 20,545
  • 20
  • 91
  • 102
Sonu Agarwal
  • 97
  • 2
  • 12
  • 1
    Welcome to StackOverflow! Please show us what you have tried, what results you expected and what results you received. – Marijn Jan 04 '16 at 18:28

1 Answers1

0

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.

BValluri
  • 916
  • 1
  • 6
  • 10