Created
July 30, 2013 10:10
-
-
Save GongLe/6111770 to your computer and use it in GitHub Desktop.
JPA @onetomany 级联删除Many端
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| When we use JPA @oneToMany | |
| if you remove a dependent object from a OneToMany collection it will not be deleted, JPA1.0 don’t support it itself, it requires that you explicitly call remove() on it. | |
| In JPA2.0 ,you need do add “orphanRemoval” to “@OneToMany” , | |
| just like this: | |
| @OneToMany(mappedBy = "A", orphanRemoval=true,cascade = CascadeType.ALL) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment