Java JPA存储库未发出删除请求
我有一个实体Java JPA存储库未发出删除请求,java,spring,hibernate,spring-data-jpa,Java,Spring,Hibernate,Spring Data Jpa,我有一个实体 @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;
@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 annotation的方法,但hibernate不执行查询。日志中没有要删除的sql查询
我做错了什么
谢谢 是否有任何错误日志???@Afridi nothing..(是否为
ExpertAndRequestRepository.delete
静态方法?否,我拼写错误。修复了通过提交事务显式或隐式触发刷新的问题?