Also we need to check Victor's comment:
https://issues.apache.org/jira/browse/CAY-1009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12804515#action_12804515
2010/2/7 Andrey Razumovsky <razumovsky.andre..mail.com>
> As far as i remember, the problem is if we have a mapping:
> entities:
> A
> B extends A - mapped in same db table
> C
>
> dbRel:
> toA, cArray (from C to A and vice versa) - Is Mandatory
>
> objRel - toA, cArray (from C to A and vice versa)
>
> So, there's isn't any ObjRel from B to C and therefore Cayenne adds runtime
> relationship.
> Problems come when we're setting relationship via C.setToA(..) and commit.
> Cayenne thinks runtime rel from C to B is mandatory (after all, it's mapped
> to mandatory dbRel) and fails to commit.
> Not sure why I haven't added test maps when committing, maybe I haven't
> managed to create one.
> We need to investigate this futher, so please hold on reverting the patch
>
> 2010/2/7 Andrus Adamchik <andru..bjectstyle.org>
>
> 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.
>>>>
>>>
>>>
>>>
>>
>
>
> --
> Andrey
>
-- Andrey
This archive was generated by hypermail 2.0.0 : Sun Feb 07 2010 - 10:39:59 EST