[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6942) Envers Collection revision entries don't include deletes on detached entity saveOrUpdate
Karl Walsh (JIRA)
noreply at atlassian.com
Fri Jan 6 06:42:12 EST 2012
Envers Collection revision entries don't include deletes on detached entity saveOrUpdate
----------------------------------------------------------------------------------------
Key: HHH-6942
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6942
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.6.8
Reporter: Karl Walsh
Attachments: TestCase.zip
Please see http://community.jboss.org/thread/175787?tstart=0
When a detached entity has some children removed by replacing the collection of children with a smaller collection, the audit entries do not contain the deletes when performing a saveOrUpdate. Using merge does include the correct delete revisions.
e.g
Parent contains children Child(A) and Child(B)
Parent -> (ChildA, ChildB)
If this collection is replaced with a new collection:
Parent -> (ChildA)
And a saveOrUpdate is issued on the parent, the audit entries doesn't include the delete for ChildB.
However, if the child is explicitly removed from the collection:
Parent.getChildren().remove(ChildB)
The saveOrUpdate works as expected and the delete of ChildB is audited correctly.
Using merge instead of saveOrUpdate allows the collection of children to be replaced rather than an explicit removal, and audit entries correctly register the delete of ChildB.
I have not tested this beyond 3.6.8.Final.
I have attached a spring/maven test case. Any questions let me know.
Karl
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list