Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么我删除食物时没有删除反馈?我对反馈集有以下映射。发出这样的命名查询delete from Food where id = :id。(是的,我在移除时设置了 id)。
delete from Food where id = :id
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) @JoinColumn(name = "food_id") private Set<Feedback> feedback;
JPA CascadeType.ALL的副本不能通过查询工作?.
JPQL 删除查询不会触发级联。
改用 EntityManager.remove()