Affects Version/s: None
Fix Version/s: None
Bug Testcase Reminder (view):
Last commented by a user?:true
Use hibernate.envers.store_data_at_delete = true
Creates a parent.
Creates a child for it.
You get one revision, one Parent_AUD (create), and one Child_AUD (create).
Deletes the parent.
Deletes the child. In my case, this is via cascade.
You get one revision, one Parent_AUD (delete), and one Child_AUD (delete).
Lookup using the following code:
This throws an exception:
When store_data_at_delete is true, the second Child_AUD entry contains a link to Parent_AUD, instead of a NULL. The audit query tries to build Child entities out of the two Child_AUD entries but fails for the second one. Why does it fail? Because the SQL query it uses to fetch the correct Parent_AUD entry ignores entries with revision type DEL. Here's the corresponding comment from EntitiesAtRevisionQuery.list():
I think the right thing to do here is relax that last condition when we're fetching a relation for a DEL audit entry.
Here's the corresponding forum post: https://community.jboss.org/message/800890