cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johannes <jotpe....@gmail.com>
Subject Re: setter for toMany in generated classes
Date Tue, 27 Jan 2015 18:49:21 GMT
Looks better than a delete parameter.

What do you mean with sync? Synchronized method?

Regards Johannes

Am 26.01.2015 um 22:23 schrieb Andrus Adamchik:
> 
>> On Jan 26, 2015, at 1:47 PM, Johannes <jotpe.osm@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
> 
> 
> 
> 
> 


Mime
View raw message