Hibernate: How to ensure that a parent is not deleted when all its child entities are?
问题 I am deleting entities and hence rows from my database. I do want to delete a certain entity and all of its child rows. However, I do not want to delete any rows from its Parent . How can I accomplish this? Kennel is the Parent Entity and Dog is the entity I am deleting. Please see code below to how I have linked the 2 in the Kennel Entity: @OneToMany(cascade = CascadeType.MERGE, orphanRemoval = false) @JoinColumn(name = "KENNEL_ID", referencedColumnName = "ID", updatable = true, insertable =