RE: to-many relationship after delete

From: Cris Daniluk (cris.danilu..laraview.com)
Date: Mon Feb 14 2005 - 09:23:28 EST

  • Next message: Jonathan Carlson: "Wicket and Tapestry was: [Cayenne vs. EOF...]"

    In the modeler tool, set the "course" relationship "toUsers" Delete Rule to
    be "Nullify".

    Still not sure why this isn't a default, but I guess you can get yourself
    into trouble sometimes if you're not careful with it :)

    Cris

    > -----Original Message-----
    > From: Koen Segers [mailto:KoenSeger..carlet.be]
    > Sent: Monday, February 14, 2005 7:36 AM
    > To: cayenne-use..bjectstyle.org
    > Subject: to-many relationship after delete
    >
    > Hi,
    >
    > I have a table course that has a Userid in it.
    >
    > I can get the list of courses from a specific user. That's nice btw!
    >
    > The problem arises when I want to delete a course.
    > When I delete the course it isn't deleted from the list that
    > the user has.
    > I know you can make it happen by removing it from the list of
    > courses in user, but musn't this be done automaticly?
    >
    > Delete operation:
    > context.deleteObject(course);
    > // I believe this must be done automaticly...
    > course.getToUsers().removeFromCourseArray(course);
    > context.commitChanges();
    >
    > Greetz
    > --
    >
    > Koen Segers
    >
    > <koenseger..carlet.be>
    > <http://eddyvite.dyndns.org>
    >



    This archive was generated by hypermail 2.0.0 : Mon Feb 14 2005 - 09:23:31 EST