Hi,
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?
Anyway, I can solve this problem overwriting the equals() method for
each CayenneDataObject , in order to compare the PKs.
Any explanation will be grateful,
Jorge
This archive was generated by hypermail 2.0.0 : Tue Oct 19 2004 - 11:21:54 EDT