在这种情况下我该怎么办?我需要将其从集合和对象中删除还是仅从对象中删除?
val x = xRepo.findById(id)
val y = x.y
// Option one
x.y = y
// Option two
y.xList = y.xList.add(x)
// Option three
x.y = y
y.xList = y.xList.add(x)
第二个问题:
在这种情况下会发生什么?
val x = xRepo.findById(id)
val y = x.y
xRepo.delete(x)
// What happens to the x in the y collection? Do I need to remove it before it deletes it or will spring do it??