cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (CAY-319) Filtered Prefetches
Date Tue, 03 May 2011 14:12:03 GMT

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

Andrus Adamchik closed CAY-319.
-------------------------------

       Resolution: Duplicate
    Fix Version/s:     (was: Undefined future)

This was fixed in 3.0. No longer an issue.

> Filtered Prefetches
> -------------------
>
>                 Key: CAY-319
>                 URL: https://issues.apache.org/jira/browse/CAY-319
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 1.1 [LEGACY], 1.2 branch
>            Reporter: Cris Daniluk
>            Assignee: Andrus Adamchik
>
> Given an expression graph and a prefetch graph, the prefetched query will be filtered
by any intersecting nodes. As an example, the following query:
> SelectQuery userSearchQuery = new SelectQuery(User.class,
> ExpressionFactory.matchExp("toUserRole.toRoleArray", searchRole));
> userSearchQuery.addPrefetch("toUserRole");
> will produce an incomplete "toUserRole" relationship, filtering out all but the roles
that were searched for. The SQL generated by such a query is provided below:
> SELECT DISTINCT t0.TX_FIRST_NAME, t0.TX_LAST_NAME, t0.TX_LOGIN_NAME,
> t0.NU_USER_ID FROM USER t0, USER_ROLE t1 WHERE t0.NU_USER_ID =
> t1.NU_USER_ID AND ((t1.NU_ROLE_ID = ?) AND (UPPER(t0.TX_LOGIN_NAME)
> LIKE UPPER(?))) [bind: 0, 'cris']
> === returned 1 row. - took 141 ms.
> SELECT t0.NU_ROLE_ID, t0.NU_USER_ID FROM USER_ROLE t0, USER t1 WHERE
> t0.NU_USER_ID = t1.NU_USER_ID AND ((t0.NU_ROLE_ID = ?) AND
> (UPPER(t1.TX_LOGIN_NAME) LIKE UPPER(?))) [bind: 0, 'cris']
> === returned 1 row. - took 93 ms.
> As noted, the second query binds the role. Given 2 graphs with non-empty intersections,
it is not possible to do this query without a subselect. The following approaches could resolve
this issue:
> 1. The prefetch could be removed (with a WARN log event)
> 2. The relationship could be left as a fault, with the objects that
> were prefetched pre-resolved
> 3. A subselect (or select ... in) could be used on supported database adapters.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message