I am trying to delete child entry from the table and my entity has 2-way relation. I got an exception "Cannot delete or update a parent row: a foreign key constraint fails". I need mapping when I delete child entry relation with parent automatically dropped.
@Entity
@Table
public class RuleModel implements Comparable<RuleModel> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "Rule_Id", unique = true, nullable = false)
protected Integer id;
@OneToOne(fetch = FetchType.EAGER)
protected RuleModel parent;
@OneToOne(fetch = FetchType.EAGER)
protected RuleModel child;
}