Just upgraded from 4.3.8.Final to 4.3.11.Final and noticed a break in my tests due this change in CascadeStyles.java (rev hash e4715cc5). I have the following scenario:
@Entity
public class Chat() {
@OneToMany(mappedBy = "chat", cascade = CascadeType.MERGE, fetch = FetchType.EAGER, orphanRemoval = true)
public Set<ChatMember> getMembers() {
return members;
}
}
PS: Perhaps it is my misconception in using the MERGE cascade (I deal with other actions myself using hql or direct reference for performance sake) , but this was working just fine until 4.3.8.Final. Using the CascadeType.ALL will work. I've notice that deleteOrphans() is false for CascadingAction MERGE so orphan removals never occurs in that moment. Since PERSIST_ON_FLUSH is no longer accept in CascadeStyle DELETE_ORPHAN, my removed items from members collection remains forever. |