I was seeing this problem on version 3.2.0.cr2:
Code:
Don't change the reference to a collection with cascade="all-delete-orphan"
After much tracing through the code to be sure that I wasn't actually dereferncing the collection, I realised that the problem was that I was:
Code:
save(entity);
but that I needed to:
Code:
saveOrUpdate(entity); //entity is already in database, although there are new child rows.
It is interesting to me that other types of cascade, "save-update" and "all" do not have a similar issue. At least, they didn't complain about save vs. saveOrUpdate. Anyway, maybe I can save someone else the time that I wasted tracking this down with this post.
If it makes a difference, the relationship was relatively involved, if not atypical:
parent (1) < -- > (1..*) {ordered} children lazy="false", cascade="all-delete-orphan"