I have a Spring Boot project using JpaRepository.
I have two entities, Threat and Dimension, in the database I have 3 tables: tbl_threat, tbl_dimension and tbl_threat_dimension (that relates which dimension each threat has)
I want to delete a relationship row in thread_dimension table. How can I solve this?
@Entity(name = "tbl_threat")
public class Threat {
@Id
private String id;
@Column(nullable = false)
private String name;
@ManyToOne
private User user;
@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinTable(name = "threat_dimension", joinColumns = {
@JoinColumn(name = "threat_id")}, inverseJoinColumns = {
@JoinColumn(name = "dimension_id")})
private List<Dimension> dimensions;
@Entity(name = "tbl_dimension")
public class Dimension {
@Id
private String id;
@Column(nullable = false)
private String name;
}