Re: Read-only many to many

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Jun 10 2005 - 13:47:03 EDT

  • Next message: Nick Stuart: "Re: Read-only many to many"

    Nick,

    I was able to reproduce the problem. There was one more inconsistency in
    your mapping - to-many set from join table to its parents, when it should
    be to-one (see attached data map where this is fixed) ...

    However there is also a bug in the Modeler - once I changed to-many
    settings, incorrect classes were still generated. Once I closed and
    reopened the project, everything worked again. So "read-only" setting was
    cached incorrectly.

    Could you please open a bug report in Jira for that...

    Debugging it was surely a pain... I guess we may also add a visual
    indication for read only relationship with a mouse-over explanation of the
    reasons...

    Andrus

    > Ok, well I did this, and even went so far as to re-create all the
    > many-to-many relations/tables/etc all over again and still nothing.
    > Going to move on with out it for now, but hopefully we'll be able to
    > sort it out. :)
    >
    > -Nick
    >
    > On 6/10/05, Andrus Adamchik <andru..bjectstyle.org> wrote:
    >> You need to check it on the side of each master table: "tapn_users" and
    >> "tapn_forum", and UNcheck for the join table.
    >>
    >> Andrus
    >>
    >> > Ok, so I need to have the "To Dep PK" checked in which, the Forum
    >> > table, or the join table? As you can see, still confused. :)
    >> >
    >> > But, I think I tried it both ways and either way it didnt make a
    >> > difference, still only got getModerators and no add or remove methods
    >> > with it. (in either case, checking one or the other nothing in the
    >> > class changed. Should I recreate the relationships in the classes
    >> > after I check the boxes?)
    >> >
    >> > I think the biggest confusion has to do with the "TO" in the
    >> > description. Just taking that out would be better, "Dependent PK"
    >> > makes more sense to me at least. Or even, "Dependent ON PK" or
    >> > something like that.
    >> >
    >> > -Nick
    >> >
    >> > On 6/10/05, Andrus Adamchik <andru..bjectstyle.org> wrote:
    >> >> Nick,
    >> >>
    >> >> "to dep pk" has to be the other way around. What it means is that
    >> MASTER
    >> >> table propagates its PK to its DEPENDENT table. "tapn_users" and
    >> >> "tapn_forum" are both masters and "tapn_fmoderators" is a dependent
    >> >> table.
    >> >>
    >> >> BTW, if anybody can suggest a better name for this flag (or maybe a
    >> >> suggestion how to improve UI that sets it), please post your
    >> >> suggestions.
    >> >> While "to dep pk" is technically correct, it does cause confusion.
    >> >>
    >> >> Andrus
    >> >>
    >> >> > Just tried it, and nothing.
    >> >> >
    >> >> > Attaching the map file.
    >> >> >
    >> >> > Thanks again,
    >> >> > -Nick
    >> >> >
    >> >> > On 6/10/05, Andrus Adamchik <andru..bjectstyle.org> wrote:
    >> >> >> Hi Nick,
    >> >> >>
    >> >> >> Do you have "To Dep PK" checked for these two relationships:
    >> >> >>
    >> >> >> Forum->join table
    >> >> >> User -> join table
    >> >> >>
    >> >> >> If this doesn't help, please send your *.map.xml file - it may
    >> give
    >> >> some
    >> >> >> clues.
    >> >> >>
    >> >> >> Andrus
    >> >> >>
    >> >> >> > Ok, so I'm a newb to Cayenne and this has probably already been
    >> >> >> > answered, but since i can't find a searchable list archive
    >> >> anywhere,
    >> >> >> > here goes.
    >> >> >> >
    >> >> >> > I've got a many-to-many relationship I'm trying to build and it
    >> >> looks
    >> >> >> > like everything is working, but the classes generated only let
    >> me
    >> >> get
    >> >> >> > the list and not add to them. I've got a join table and
    >> >> relationship
    >> >> >> > to both ids and all the chained joins appear to be setup
    >> correctly
    >> >> in
    >> >> >> > the objects, but still no love.
    >> >> >> >
    >> >> >> > What am I missing to be able add to the join table? I've tried
    >> just
    >> >> >> > about every combo I can come up with, but there must be
    >> something.
    >> >> >> > BTW, this is with 1.2M4.
    >> >> >> >
    >> >> >> > This is a simple mapping:
    >> >> >> > Users can be moderators of several Forums
    >> >> >> > Forums can have several User moderators
    >> >> >> >
    >> >> >> > Join table with userId and forumId
    >> >> >> > user relationship going from the join table userId to user table
    >> Id
    >> >> >> > same for forums.
    >> >> >> >
    >> >> >> > Chained relations
    >> >> >> > Forum->join table -> user table
    >> >> >> > User -> join table -> forum table
    >> >> >> >
    >> >> >> > Thanks for the help!
    >> >> >> > -Nick
    >> >> >> >
    >> >> >>
    >> >> >>
    >> >> >
    >> >>
    >> >>
    >> >
    >>
    >>
    >





    This archive was generated by hypermail 2.0.0 : Fri Jun 10 2005 - 13:47:04 EDT