Re: Weird Behaviour with Nullify rule

From: Jorge Sopena (jsopen..idsa.es)
Date: Tue Oct 19 2004 - 12:04:21 EDT

  • Next message: Mike Kienenberger: "Re: Weird Behaviour with Nullify rule"

    Mike Kienenberger wrote:

    >Jorge Sopena <jsopen..idsa.es> wrote:
    >
    >
    >>Recently I've found a strange behaviour when I delete a
    >>CayenneDataObject who belongs to a toMany relationship.
    >>I've got an object Company which has 1..n objects Path. In the modeler I
    >>created a toMany relationship with delete rule = Nullify.
    >>
    >>Well,
    >>At any moment, I do Company.getListPaths() and I get Path1 and Path2.
    >>After I do a SelectQuery to recover Path1.
    >>Then I delete Path1, and Company.getListPaths() only returns Path2, so
    >>everything is right.
    >>
    >>But, in this other case the behaviuor isn't "correct" or as I expected.
    >>I do Company.getListPaths() and I get Path1 and Path2.
    >>After I create Path3 = new Path() and I do Path3.setCompany(Company).
    >>Now the list Company.getListPaths() is Path1, Path2 and Path3.
    >>After, I do a SelectQuery to recover Path3.
    >>Then I delete Path3, but Company.getListPaths() has still Path1, Path2
    >>and Path3.
    >>
    >>In the DB all the information is correct but in Cayenne the information
    >>is inconsistent.
    >>Debugging the system I've realised that Cayenne try to find the new
    >>Path3 in the list but it doesn't find it.
    >>For the system the Path3 recovered by the SelectQuery isn't equals() the
    >>Path3 is in the list.
    >>
    >>Why happens this? Why are different Objects in case 2 and equals Objects
    >>in case 1?
    >>
    >>
    >
    >
    >After this code,
    >
    >Path3 = new Path();
    >Path3.setCompany(Company);
    >
    >Did you do a
    >
    >dataContext.commitChanges();
    >
    >
    >
    >

    Yes, of course.
    I forgot writing it down.



    This archive was generated by hypermail 2.0.0 : Tue Oct 19 2004 - 12:00:05 EDT