Actually Bryan's case seems to be pretty clear. I will try to create a
test case for it now:
We have a source entity with two to-one relationships to target
entities that both inherit from the same table. When we try to
insert a new instance of the source entity, we get:
org.apache.cayenne.CayenneRuntimeException:
Error resolving to-one fault. More than one object found. Source
Id:
<ObjectId:Claim, CLAIM_ID=8891>, relationship:
runtimeRelationship0
org.apache.cayenne.access.ToOneFault.doResolveFault(ToOneFault.java:
90)
org.apache.cayenne.access.ToOneFault.resolveFault(ToOneFault.java:
54)
Cayenne found two objects in the table and thought it was an error.
On Feb 7, 2010, at 5:18 PM, Andrus Adamchik wrote:
Guys, we need to do something about CAY-1009. The fix doesn't look
logical to me, and now it turns out that it breaks other things per
CAY-1378.
I am looking at commented out test case
InheritanceTest.testCAY1009() that Kevin created, and from what I
can tell, Cayenne does the right thing here (without the CAY-1009
fix). I.e. DirectToSubEntity.subEntities is NOT a reverse
relationship of BaseEntity.toDirectToSubEntity, so we should not
expect it to behave as one.
Bryan and Andrey also had problems with "runtime" relationships. So
could you create test cases for those so we can maybe try looking
for the another cause is elsewhere? Or maybe you could provide a
failing mapping and describe the problem?
Andrus
Begin forwarded message:
Andrus Adamchik updated CAY-1378:
---------------------------------
Attachment: 0001-CAY-1378-no-reverse-for-inheritance.patch
I tend to agree with Victor. Here is my patch reverting CAY-1009
commit (plus some minor loop refactoring). This fails uncommented
InheritanceTest, but I think the test is wrong. I won't commit this
yet, and will take further discussion to the dev list.