Re: modifying relationship list

From: Tomi NA (hefes..mail.com)
Date: Mon Jun 19 2006 - 04:12:50 EDT

  • Next message: Andrus Adamchik: "Re: modifying relationship list"

    On 6/19/06, Marcin Skladaniec <marci..sh.com.au> wrote:
    > Hello
    > Just run into interesting cayenne feature.
    >
    > This code:
    >
    > rooms = site.getRooms();
    > rooms.remove(aRoom);
    >
    > would alter the relationship
    >
    > so aRoom.getSite() is now null
    >
    > I'm wondering if this is a desired effect ?
    > This behavior might cause bugs. When someone actually puts code to
    > know the fact of relationship being changed (ie. put code into Room
    > setSite() and Site add/removeFromRooms()/setRooms() methods ) he
    > might be disappointed, as those methods would not run, but the
    > relationship will change...

    I'm wrestling with this issue myself: I've extended the basic
    templates so that events are fired on setter calls, but this practice
    has the exact shortcomings you pointed out.
    Is there a very good reason why cayenne objects don't fire events on a
    lower level (circumventing this problem) out of the box?
    Alternatively, if I expand my object code generation templates further
    so that objectA.removeFrom(objectB) fires a property change event for
    it's objectA.getBArray() as well as objectB.getToA() - will this
    completely solve the problem?

    t.n.a.



    This archive was generated by hypermail 2.0.0 : Mon Jun 19 2006 - 04:13:18 EDT