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 Fri, 19 Dec 2014 14:00:19 GMT
Good point, I thought reverse relationships are refreshed autimatically.
My expectation was based on the note "... from any kind of
relationship..." at http://cayenne.apache.org/docs/3.0/relationships.html
I will replace the methods!

I think you are an advanced user, if you only use your own templates and
answer to dev mailinglist. But to offer such a BASIC functionality in
normal generated classes would be a nice service for new users.

Thanks Johannes

Am 18.12.2014 um 21:12 schrieb Mike Kienenberger:
> As I said before, I think you need to call
> removeToManyTarget("${rel.Name}", obj, true); instead of
> iterator.remove() and removeAll(), and then you need to call
> addToManyTarget() instead of addAll().  Otherwise, you are losing the
> reverse relationship changes.
> 
> But the rest seems ok.
> 
> I'm not saying that adding setList() to the default template is a good
> idea, though.   I think having it in your custom template is good
> enough.
> 
> I do everything with custom templates and rarely use the default
> cayenne templates.
> 
> 
> On Thu, Dec 18, 2014 at 2:58 PM, Johannes <jotpe.osm@gmail.com> wrote:
>> Hello,
>>
>> following the conversation from
>> http://mail-archives.apache.org/mod_mbox/cayenne-user/201412.mbox/%3C548BDF97.1040104%40gmail.com%3E
>> there seems to be a common need for having a new method next to
>> addXXX, removeXXX a setXXXs in generated classes from CayenneModeler.
>>
>> I created a first draft
>> https://github.com/jotpe/cayenne/commit/6627c09936285c7650d69f44a95ba2f4b118f2b6
>>
>> Would anybody be so nice to review it? I'm not sure if these lines can
>> run in every environment without trouble. What about tests?
>>
>> Best regards Johannes
>>


Mime
View raw message