简体   繁体   English

Spring JPA并从@ManyToMany中删除条目

[英]Spring JPA and remove entries from @ManyToMany

As touched on in the following: 如下所述:

when removing entries from @ManyToMany mappings, there is an element of manual tweaking involved to remove the foreign keys. @ManyToMany映射中删除条目时,有一个手动调整元素来删除外键。

I have been using my own JPA CRUD for years and have a nice solution for this: CrudDao eg NoteDao . 我多年来一直在使用自己的JPA CRUD,并为此提供了一个很好的解决方案: CrudDao,例如NoteDao

But I've been recently very impressed by Spring JPA and the ability to autogenerate Cruds by declaring an interface and then creating similarly named namedQuery s on the @Entity . 但是最近我对Spring JPA以及通过声明一个接口然后在@Entity上创建类似命名的namedQuery来自动生成Cruds的能力印象深刻。

But how do I fix the @ManyToMany remove problem? 但是如何修复@ManyToMany删除问题呢? I'll essentially have remove methods on my Crud that expose this "feature" of JPA. 我基本上已经remove了我的Crud上的方法,揭示了JPA的这个“特性”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM