We found one reason, why this can happen. We had a collection mapping with the following set method in the pojo
Code:
public class pojo {
....
private SortedSet _users = new TreeSet(_comparator);
----
private final void setUsers( SortedSet users )
{
if ( users == null || users.isEmpty() )
return;
_users = users;
}
....
}
What happens here is, that hibernate calls the setxx() with an initialized, but empty collection. This is not set so the collection stays as the constructor left it. It may be null in other cases. When re-associating, hibernate sees a collection, which has not been set by it. So it can only conclude, that someone else has called setxxx(), which makes the collection really dirty.
Rule: Only use simple set methods