我有一个实体
@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
}
}
执行时
this.expertAndRequestRepository.delete(request);
调用标有@PreRemove注释的方法,但hibernate不执行查询。在日志中没有要删除的SQL查询...
我做错了什么?
谢谢!