A previous forum post from
https://forum.hibernate.org/viewtopic.php?f=1&t=979340 pointed me in the right direction. Based on the API for onCollectionUpdate:
Code:
onCollectionUpdate(Object collection, Serializable key)
collection always appears to be of type PersistentCollection (I'm not sure why the API does not simply specify this type in the method argument), and
key seems to refer to the @Id of the owning entity.
When cast as a PersistentSet which implements the java.util.Set interface,
collection behaves as a normal Java collection containing the new values. The old values can be obtained by invoking collection.getStoredSnapshot() which (in my case at least) returns a java.util.HashMap.
I'm not sure why a HashMap is returned when a simple List-type collection would suffice. Examining the contents of the HashMap show key-value pairs where key = value. In any case, I am now able to get both the old and new values, and determine a delta from there.