From what I remember (PR was submitted more than half a year ago), the idea was to keep a snapshot regardless of whether collection is mutable or not, and use that "state" to clear the "dirty" flag if nothing really changed. So, basically, PR consists of two parts: one to clear dirty flag given the previous "state" (obviously, this reduces number of update events regardless of collection mutability (check MergeCollectionEventTest.java diff)) and another one to have something to compare to in case of immutable collection (and this is where "use null as a snapshot optimization" has been dropped). Unfortunately, without the latter I don't think there is was to track stuff like entity.setCollection(new HashSet(entity.getCollection)) (just an example).
|