Finally I found the solution: The compareTo method of the Group entity was implemented wrong an did not return 0 for equal objects. And because the person.groups is a SortedSet, it relies on the compareTo() method to find the matching entry.
So the remove() did not really remove an element, because it did not find the element to be removed. Consequence: No change an person instance, no cache invalidation.
After fixing the compareTo, everything works as expected, even with the code example in my first post.
|