Prevent Hibernate from deleting orphaned entities while merging an entity having entity associations with orphanRemoval set to true
问题 Taking a very simple example of one-to-many relationship (country -> state). Country (inverse side) : @OneToMany(mappedBy = "country", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true) private List<StateTable> stateTableList=new ArrayList<StateTable>(0); StateTable (owning side) : @JoinColumn(name = "country_id", referencedColumnName = "country_id") @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH, CascadeType