> On Jan 26, 2015, at 1:47 PM, Johannes <jotpe....@gmail.com> wrote:

> My motivation for introducing the delete parameter was, that your are
> not able to the treat orphaned objects with a delete rule. Please
> correct me, if its wrong. The delete rule is called only, if you trigger
> .delete(). If you just remove your relationship: no entity will be
> deleted. I guess this is the deletion question Michael Gentry was
> talking about.

Good point about delete rules. You are absolutely right and I stand corrected. 
Perhaps one other way to deal with deletions, is to return a collection of 
removed objects from the method, leaving it up to the caller to deal with them:

// sync...
List<? extends DataObject> removed = 
o.setToManyTarget(Artist.PAINTINGS.getName(), newPaintings, true); 

// delete ... or not
// o.getObjectContext().deleteObjects(removed); 

Andrus





Reply via email to