문제

I have EntityA and EntityB. EntityA has a to-many relationship with EntityB.

I have several EntityB objects that have been set as related (children) to EntityA. How can I delete that relationship without deleting any of the Entity objects?

도움이 되었습니까?

해결책

Try the following:

EntityB entityB = myEntityBDao.load(id_entityB);
entityB.setEntityA(null);
entityB.update();

This just deletes the relation and modifies entityB, but a formerly related EntityA should not be deleted or even modified.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top