我有以下问题,有设备:
@OneToMany(mappedBy = 'sender', cascade = CascadeType.ALL, fetch = FetchType.EAGER) Set<Gift> sentGifts = []
@OneToMany(mappedBy = 'receiver', cascade = CascadeType.ALL, fetch = FetchType.EAGER) Set<Gift> receivedGifts = []
和礼物:
@ManyToOne Device sender
@ManyToOne Device receiver
问题是我无法理解如何正确删除礼物。
我可以这样做 > gift.sender = null > save(gift) > gift.receiver = null > save(gift) > ...
但我认为这不是正确的方法,也许应该以另一种方式指定级联?
谢谢!