There are the following two entities:
@Entity
public class PublishingPlatform {
@Id
private int id;
@OneToMany(mappedBy = "platform", cascade = CascadeType.REMOVE)
private List<Post> posts;
}
@Entity
public class Post {
@Id
private int id;
@ManyToOne
@JoinColumn(name = "platform_id")
private PublishingPlatform platform;
}
What happens to all Posts connected to an instance of a PublishingPlatform, if we delete the row corresponding to this instance from the PublishingPlatform table?