存在多对多关系的绑定实体。当我删除依赖实体时,我希望也删除该实体。调用preRemove方法,但hibernate不会构建删除请求。
我做错了什么?
请帮助,3天试图解决问题((
@Entity
@Data
@Table(name = "SOME_TABLE_NAME")
@IdClass(ExpertAndRequestId.class)
public class ExpertAndRequest implements Serializable {
@Id
private Long managerId;
@Id
private Long requestId;
private String comment;
@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinColumn(name = "managerId", updatable = false, insertable = false, referencedColumnName = "id")
//@OnDelete(action = OnDeleteAction.CASCADE)
private Manager manager;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "requestId", updatable = false, insertable = false, referencedColumnName = "id")
private ParticipantRequest request;
@PreRemove
public void preRemove(){
// THIS METHOD EXECUTED
}
}