0

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?

Wise Shepherd
  • 2,228
  • 4
  • 31
  • 43

1 Answers1

1

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.

AlexS
  • 5,295
  • 3
  • 38
  • 54