-
1. Re: Conditional Auditing - entering into infinite loop
adamw Sep 3, 2012 3:38 PM (in response to gpkreddy)First of all, audit should happen only if the entity *is* modified. What duplicate records are you seeing?
Adam
-
2. Re: Conditional Auditing - entering into infinite loop
gpkreddy Sep 4, 2012 9:38 AM (in response to adamw)Yes I do agree that. But the tables I am auditing has columns like DateModified and other trivial stuff which is making an update on the actual entity(in return causing an insert into audit table).
So, I am trying to omit such kind of updates.
-
3. Re: Conditional Auditing - entering into infinite loop
adamw Sep 9, 2012 1:47 PM (in response to gpkreddy)Re-fetching the current entity causes Hibernate's session to flush, which causes the infinite loop. You need either to:
1. enable manual flush
2. read the old data in another tx
(both I wouldn't recommend)
or, best solution,
3. read the PostUpdateEvent.oldState array directly.
Adam
-
4. Re: Conditional Auditing - entering into infinite loop
gpkreddy Sep 10, 2012 4:51 PM (in response to adamw)Thanks for you reply. But, Tying to access the oldState value in onPostUpdate() gave me null
Is it because the object is a detached one?. If so what should I do to fix this one
-
5. Re: Conditional Auditing - entering into infinite loop
adamw Sep 28, 2012 9:55 AM (in response to gpkreddy)What about pre update?
Adam