Hello Michael,

yes, this was Andrus idea. I like it.


----------------
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);
------------


Am 07.12.2015 um 16:49 schrieb Michael Gentry:
> Hi Johannes,
> 
> Are you anticipating something like this if you want to actually delete
> objects instead of just unlink them?
> 
> dataContext.deleteObjects(cayenneDataObject.setToManyTarget(...));
> 
> Thanks,
> 
> mrg
> 
> 
> On Mon, Dec 7, 2015 at 1:33 AM, Andrus Adamchik <and...@objectstyle.org>
> wrote:
> 
>> Thanks for the new version. Looks good to me. Let's maybe write some unit
>> tests and create a new pull request.
>>
>> Andrus
>>
>>> On Dec 7, 2015, at 1:07 AM, Johannes <jo...@posteo.de> wrote:
>>>
>>> Sure, here is a tidy commit:
>>>
>> https://github.com/apache/cayenne/commit/1358dad4e3ae2cf2735aa223b869e4b85f18508e
>>>
>>> Didn't know how to manipulate commits afterwards. I closed the pull
>>> request and made my clean commit on a fresh reforked master version.
>>>
>>> Best Regards. Johannes
>>>
>>> Am 06.12.2015 um 10:05 schrieb Aristedes Maniatis:
>>>> Great. Do you want to tidy up the commits on your pull request.
>>>>
>>>> https://github.com/apache/cayenne/pull/61/commits
>>>>
>>>> Ari
>>>>
>>>> On 6/12/2015 2:19am, Johannes wrote:
>>>>> Dear list,
>>>>>
>>>>> I want to bring back my idea from February into discussion. It was
>> about
>>>>> introducing a setToManyTarget Method in the CayenneDataObject, but it
>>>>> was not finished (mail archive:
>>>>>
>> http://mail-archives.apache.org/mod_mbox/cayenne-dev/201501.mbox/%3C0DBA750D-A847-4CC1-8EAC-9DCFB5A0FECA%
>>>>> 40objectstyle.org%3E )
>>>>>
>>>>>
>>>>> My last action was, implementing Andrus advice to retrieve old
>>>>> DataObjects, which can be deleted manually:
>>>>>
>>>>> // sync...
>>>>> List<? extends DataObject> removed =
>>>>> o.setToManyTarget(Artist.PAINTINGS.getName(), newPaintings,
>>>>> true);
>>>>>
>>>>> // delete ... or not
>>>>> // o.getObjectContext().deleteObjects(removed);
>>>>>
>>>>>
>>>>> This was implemented immediatly by myself with following commit, but I
>>>>> forgot to mention it on the list:
>>>>> It was implemented in
>>>>>
>> https://github.com/jotpe/cayenne/commit/b930886a9ab24fa8b82a7e8efeaf6d2437bd5d96
>>>>>
>>>>>
>>>>> Best Regards.
>>>>> Johannes
>>>>>
>>>>
>>>
>>>
>>
>>
> 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to