Relative Content

Tag Archive for sqlspring-bootspring-data-jpaspring-datadelete-row

2 colums in a child table have foriegn key relation with same parent table how to delete them using cascade in spring boot domain class

//Parent class Class parent { String id; @OneToMany(fetch = FetchType.LAZY, mappedBy = “parent1”, cascade = CascadeType.ALL) private Set<child> groupMembers = new HashSet<>(0); @OneToMany(fetch = FetchType.LAZY, mappedBy = “parent2”, cascade = CascadeType.ALL) private Set<child> groupMembers1 = new HashSet<>(0); } //clild class class child { String id; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = “parent1”) private parent parent1; @ManyToOne(fetch […]