[ 
https://issues.apache.org/jira/browse/CAY-1996?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14392951#comment-14392951
 ] 

Andrus Adamchik commented on CAY-1996:
--------------------------------------

[~johnthuss] on dev@ suggested throwing an exception for invalid combination of 
query settings , which I like more than changing the default. On the other hand 
using generated Property objects with an explicit strategy is my preferred way 
these days.

> 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
>            Assignee: Savva Kolbachev
>
> 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)

Reply via email to