Thursday 15 July 2010

JPA/hibernate - Cascade removing from db -


Hello, I have a situation like this:

Unit tags with 2 fields Many more things Which holds 2 sets of objects (Obj1, Obj2). When I want to remove Obj1, then I have all my data set in Tag Object 1. Can you tell me how to do this?


  @Entity (name = "tag") public class tag {@ @ManyToMany (fetch = FetchType.LAZY) set personal & lt; Checkpoint & gt; Checkpoints; ......} Entity (name = "checkpoint") Public square Checkpoint SerialJobile {......}   

There is no reference to the tag in the checkpoint. And if I set a cascade for a lot of things, then when I delete the tag, all the users are deleted with this tag. What do I want when the checkpoint is removed, then delete the row in the tag_checkpoint table. Should I do it myself or is it a good way to do this ??

If many more fake have been deleted, then @cascade = cascadeType.ALL Should be established. If not, you might consider excluding many uses of @OneToMany (if possible), CascadeTip.L.

No comments:

Post a Comment