cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Traversing relationships in DataRow queries?
Date Wed, 01 Apr 2015 10:48:54 GMT
> 1) When fetching data rows, can I limit the set of fields fetched, i.e. is there an equivalent
to EOF’s EOFetchSpecification.setRawRowKeyPaths( NSArray )?

Not right now. This is doable with EJBQLQuery (it allows to specify individual columns, aggregate
functions, etc). This functionality is coming soon to SelectQuery/ObjectSelect (probably in
M3).

> 2) When specifying the prefetch, why do I have to addPrefetch( A.SOME_REL.joint() ) instead
of just doing addPrefetch( “someRel” )? 

You can still use the String. A.SOME_REL form is an alternative that gives you a compile-time
guarantee that your property name is valid .

> When traversing further relationships, is this the correct way? :
> 
> q.addPrefetch( PrefetchTreeNode.withPath( "shop.chain", 1 ) );

q.addPrefetch( A.SHOP.dot(Shop.CHAIN).disjoint()) is probably a cleaner way. 

Andrus


> On Apr 1, 2015, at 1:38 PM, Hugi Thordarson <hugi@karlmenn.is> wrote:
> 
> This is perfect, thank you :). Couple of additional questions though:
> 
> 1) When fetching data rows, can I limit the set of fields fetched, i.e. is there an equivalent
to EOF’s EOFetchSpecification.setRawRowKeyPaths( NSArray )?
> 
> 2) When specifying the prefetch, why do I have to addPrefetch( A.SOME_REL.joint() ) instead
of just doing addPrefetch( “someRel” )? When traversing further relationships, is this
the correct way? :
> 
> q.addPrefetch( PrefetchTreeNode.withPath( "shop.chain", 1 ) );
> 
> Cheers,
> - hugi
> 
> // Hugi Thordarson
> // http://www.loftfar.is/ <http://www.loftfar.is/>
> // s. 895-6688
> 
> 
> 
>> On 31. okt. 2014, at 10:34, Andrus Adamchik <andrus@objectstyle.org> wrote:
>> 
>> If I understand the task correctly, a combination of JOINT prefetching and "data
rows" should probably do the trick:
>> 
>> SelectQuery<A> query = new SelectQuery<>(A.class);
>> query.addPrefetch(A.SOME_REL.joint());
>> query.setFetchingDataRows(true);
>> 
>> Andrus
>> 
>>> On Oct 31, 2014, at 1:14 PM, Hugi Thordarson <hugi@karlmenn.is> wrote:
>>> 
>>> Hi all.
>>> 
>>> Once again, I’m looking into migrating to Cayenne from EOF :). One question
though: Our code depends heavily on raw row fetching (data rows) that traverses relationships.
I haven’t looked much at the Cayenne code, but do you believe adding support for this to
Cayenne would be a huge undertaking? Or does Cayenne perhaps provide an alternative method
to achieve the same results?
>>> 
>>> Cheers,
>>> - hugi
>>> 
>>> PS: My apologies for the previous post, which my brain for some reason decided
to post as an answer to an older thread. I’m still on my first cup of coffee, and it’s
a really Monday-ish Friday up here.
>>> 
>>> // Hugi Thordarson
>>> // http://www.loftfar.is/ <http://www.loftfar.is/>
>>> // s. 895-6688
>> 
> 


Mime
View raw message