You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Hugi Thordarson (JIRA)" <ji...@apache.org> on 2015/04/01 15:15:53 UTC

[jira] [Created] (CAY-1996) Adding a prefetch to a SelectQuery via string path doesn't work

Hugi Thordarson created CAY-1996:
------------------------------------

             Summary: Adding a prefetch to a SelectQuery via string path doesn't work
                 Key: CAY-1996
                 URL: https://issues.apache.org/jira/browse/CAY-1996
             Project: Cayenne
          Issue Type: Bug
          Components: Core Library
    Affects Versions: 4.0.M2
         Environment: MySQL 5.5.40-MariaDB-36.1, InnoDB, Mac OS X 10.10, Java 8u40 (build 1.8.0_40-b27)
            Reporter: Hugi Thordarson


Adding a prefetch to a selectQuery via the relationship's name only doesn't seem to work.
Entity "SMReceipt" has a to-one relationship "shop" to the entity "SMShop". The first fetch performs a prefetch as expceted, the second fetch performs no prefetching.

----------------------------------
FETCH 1 (working)
----------------------------------
SelectQuery<DataRow> q = SelectQuery.dataRowQuery( SMReceipt.class );
q.addPrefetch( SMReceipt.SHOP.joint() );
List<DataRow> list = objectContext.select( q );
----------------------------------
GENERATED SQL
----------------------------------
SELECT t0.creation_date, t0.date, t0.modification_date, t0.shop_id, t0.storage_number, t0.text, t0.user_id, t0.id, t1.CITY_ID, t1.LOCATION, t1.NAME, t1.CHAIN_ID, t1.SHOP_ID FROM strimillinn.fd_receipt t0 LEFT JOIN strimillinn.fd_shop t1 ON (t0.shop_id = t1.SHOP_ID)


----------------------------------
FETCH 2 (not working)
----------------------------------
SelectQuery<DataRow> q = SelectQuery.dataRowQuery( SMReceipt.class );
q.addPrefetch( SMReceipt.SHOP.getName() );
List<DataRow> list = objectContext.select( q );
----------------------------------
GENERATED SQL
----------------------------------
SELECT t0.creation_date, t0.date, t0.modification_date, t0.shop_id, t0.storage_number, t0.text, t0.user_id, t0.id FROM strimillinn.fd_receipt t0



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)