I recently changed a mapping from cascade='all' to cascade='all-delete-orphan'. Now I find that when go to save the parent object, I get the message:
net.sf.hibernate.HibernateException: You may not dereference a collection with cascade="all-delete-orphan"
I'm not sure what dereferencing a collection means. Any pointers? If it's any help, what I'm doing immediately before that is:
a) Getting a list of child records matching the parent id, 'direct' from Hibernate (i.e, not via the parent record).
b) Changing a 'position' property in them, to enable a specific sort order.
c) Loading the parent record.
d) Creating a HashSet from the list.
e) Assigning it to the collection property in the parent record.
f) Saving the parent record.
This all works fine when it's just 'cascade="all"', but not when it's 'cascade="all-delete-orphan"'.
|