Jadon Hansell created CAY-2911:
----------------------------------

             Summary: Vertical Inheritance: Column Select Sometimes Null With 
Vertically Inherited Entity
                 Key: CAY-2911
                 URL: https://issues.apache.org/jira/browse/CAY-2911
             Project: Cayenne
          Issue Type: Bug
    Affects Versions: 5.0-M1
            Reporter: Jadon Hansell
         Attachments: CAY_column_query_issue.patch

This issue has symptoms similar to CAY-2552, where in EntityRowReader the 
fields size from segmentMetadata isn't equal to columns list size in 
RowDescriptor.

I think this might be caused by multiple columns in the RowDescriptor having 
the same name, so they overwrite each other when building the fields map in the 
segmentMetadata.

I have attached a patch including a breaking test on master.

The test contains the following: say I have two abstract entities {{Document}} 
and {{{}DocumentLine{}}}. {{Document}} has child entities {{DocumentA}} and 
{{{}DocumentB{}}}. {{DocumentLine}} has child entities {{DocumentALine}} and 
{{{}DocumentBLine{}}}.

{{DocumentLine}} has a many-to-one relationship to {{Document}} called 
"{{{}document{}}}" with foreign key {{{}DOCUMENT_LINE.DOCUMENT_ID{}}}.

{{DocumentB}} has a one-to-one relationship to {{DocumentA}} named 
"{{{}relatedA{}}}", with a foreign key {{{}DOCUMENT_B.RELATED_A_ID{}}}. If this 
relationship is removed the test passes.

If I query {{DocumentALine}} and column select {{DocumentALine.DOCUMENT}} to 
get its corresponding {{{}DocumentA{}}}, it works correctly. If I query 
{{DocumentBLine}} and column select {{DocumentBLine.DOCUMENT}} to get its 
corresponding {{{}DocumentB{}}}, it returns {{{}null{}}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to