You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (Jira)" <ji...@apache.org> on 2022/11/21 15:05:00 UTC

[jira] [Updated] (CAY-2778) Inheritance: queries on superclass should support subclass prefetches

     [ https://issues.apache.org/jira/browse/CAY-2778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrus Adamchik updated CAY-2778:
---------------------------------
    Description: 
For an entity inheritance hierarchy, fetching on superclass should allow prefetches on subclasses. Semantically they can be resolved as DbRelationships, and the results can be applied only to the right subclasses.

E.g. in our unit tests (where somewhat weirdly, User inherits from Role), the following code throws, while it should succeed (see attached patch with a full test) :

{noformat}
ObjectSelect.query(Role.class)
   .prefetch(User.USER_PROPERTIES.joint())
   .select(context)
{noformat}

This would allow to properly deep-refresh objects across the inheritance hierarchy.

  was:
For an entity inheritance hierarchy, fetching on superclass should allow prefetches on subclasses. Semantically they can be resolved as DbRelationships, and the results can be applied only to the right subclasses.

E.g. in our unit tests (where somewhat weirdly, User inherits from Role), the following code throws, while it should succeed (see attached patch with a full test) :

{noformat}
ObjectSelect.query(Role.class)
   .prefetch(User.USER_PROPERTIES.joint())
   .select(context)
{noformat}


> Inheritance: queries on superclass should support subclass prefetches
> ---------------------------------------------------------------------
>
>                 Key: CAY-2778
>                 URL: https://issues.apache.org/jira/browse/CAY-2778
>             Project: Cayenne
>          Issue Type: Improvement
>    Affects Versions: 4.2.RC1
>            Reporter: Andrus Adamchik
>            Priority: Major
>             Fix For: 5.0.M1
>
>         Attachments: diff.txt
>
>
> For an entity inheritance hierarchy, fetching on superclass should allow prefetches on subclasses. Semantically they can be resolved as DbRelationships, and the results can be applied only to the right subclasses.
> E.g. in our unit tests (where somewhat weirdly, User inherits from Role), the following code throws, while it should succeed (see attached patch with a full test) :
> {noformat}
> ObjectSelect.query(Role.class)
>    .prefetch(User.USER_PROPERTIES.joint())
>    .select(context)
> {noformat}
> This would allow to properly deep-refresh objects across the inheritance hierarchy.



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