delete problem 1:n realtion

From: Michael Schuldt (m..scensys.de)
Date: Wed Feb 12 2003 - 14:47:26 EST

  • Next message: Michael Schuldt: "Re: delete problem 1:n realtion"

    Hi,

    I've got a 1:n relation.

    firm 1 ---- n userGroup
    *id *id
                  firmId

    In the schema above there are only the important attributes shown.
    The relations are the following:
    - For firm: hasUserGroups (id-->firmId)
    - For userGroup: belongsToFirm (firmId-->id)

    When I try to get the UsrGroups for a firm everything works fine. I get a
    List with all matching userGroups.
    Then I try to delete a certain userGroup. I'm following the code of the
    gallery-artists example.

    Reading the firm, reading the userGroup and then calling the method
    theFirm.removeFromHasUserGroups (theUserGroup).

    Next step is the commit, but nothing happens there!

    What's wrong? Is there a problem with delete in 1:n relations? I even tried
    to use different deleteRules in CayenneModeler. But nothing helps.

    The read userGroup really belongs to the firm becaus I dumped the whole list
    of usrGroups of the firm before using the remove-Statement. Everything looks
    ok!

    What works is a n:m relation between firm and userGroup. I created a n:m
    relation between firm and userGroup using an association table. In this case
    the remove-statement works fine.

    But I think that that's not the right solution!

    Any hints?

    Michael



    This archive was generated by hypermail 2.0.0 : Wed Feb 12 2003 - 14:46:50 EST