Re: Error when adding and then removing object from relationship before committing

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Apr 30 2008 - 08:59:27 EDT

  • Next message: Kevin Menard: "Re: Error when adding and then removing object from relationship before committing"

    Hi Brian,

    On Apr 30, 2008, at 8:04 AM, Brian Nelson wrote:

    > Let me start this post by thanking the Cayenne dev team for their
    > great work. The project I'm
    > working on switched from Hibernate to Cayenne several months ago. I
    > can honestly say the decision
    > to switch is one of the best things that ever happened to my project.

    Cool. Would be nice to hear the details ;-)

    > Now on to my problem...
    >
    > I have a situation where I
    >
    > 1. Add a newly created object to a relationship.
    >
    > EstimateRoom room = context.newObject(EstimateRoom.class);
    >
    > // Several lines configuring variables in room
    >
    > floorModel.getEstimate().addToRooms(room);
    >
    > 2. Remove the object from the relationship
    >
    > estimate.removeFromRooms(obj);
    > context.deleteObject(obj);
    >
    > 3. Attempt to commit to the parent DataContext
    >
    > This works as long as the object is the last element contained in
    > the List maintaining the
    > relationship. If it is in the middle of the List(I sort the list
    > after the room is inserted) then
    > I receive the following exception.

    This turned out to be a bug. I already committed the fix. It will be a
    part of M4:

    https://issues.apache.org/cayenne/browse/CAY-1044

    Andrus



    This archive was generated by hypermail 2.0.0 : Wed Apr 30 2008 - 09:00:01 EDT