is there delete orphen in JPA
I have group and user where group must have an owner otherwise he couldn't exist in hibernate in order to achieve this outcome I do :
@ManyToOne
@org.hibernate.ann开发者_C百科otations.CascadeType.DELETE_ORPHAN
private User owner;
(inside my group entity)
my question is how to do it when my all project configuration is JPA 2.0 ?
I have solve the problem , not the ideal way but it does the work :
(inside group)
@ManyToOne(cascade=CascadeType.ALL,optional=false)
private User owner;
even thought when deleting the user the group is not deleted but this is for the logic of the application to deduce...
精彩评论