This is a migrated thread and some comments may be shown as answers.

Fetch Plan for 1 to Many

4 Answers 46 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
John
Top achievements
Rank 1
John asked on 24 Jun 2010, 03:16 AM
Hi Telerik,

I have been able to use fetch plans to successfully retrieve referenced objects in a single query where there is a 1 to 1 relationship - for example if I query OrderDetail I can retrieve the referenced Order in a single query.

I however want to be able to get an Order object and have the OrderDetail objects for that order pre-loaded in a single query.

I have tried the following but I still seem to get 2 queries - the first for retrieving the order then another for retrieving the details.

        [Telerik.OpenAccess.FetchField("Order Details Fetch Group")]
        private IList<OrderDetail> orderDetails = new List<OrderDetail>();  // inverse OrderDetail.order

Is it possible to use Fetch Plans to preload the "many" part of a 1 - Many relationship?

Thanks
John

4 Answers, 1 is accepted

Sort by
0
Accepted
Jan Blessenohl
Telerik team
answered on 24 Jun 2010, 10:10 AM
Hi John,
It is possible to join the collection into the first query. To do so you have to set ParallelFetch = true on your query definition:

OQL:
IQuery query = scope.GetOQL(...);
query.ParallelFetch = true;
query.Execute(..)

Linq:

var result = from x in scope.Extent<Person>().ParallelFetch(true) where ...

All the best,
Jan Blessenohl
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
John
Top achievements
Rank 1
answered on 24 Jun 2010, 10:02 PM
Works a treat. Thanks.
0
John
Top achievements
Rank 1
answered on 25 Jun 2010, 12:57 AM
Hi Jan,

Can I suggest you add some information about ParallelFetch() to your documentation pages on Fetch Plans.

Thanks
John
0
Pencho
Telerik team
answered on 25 Jun 2010, 06:27 PM
Hi John,

Thanks a lot for your suggestion. We will revisit (update) the part of our documentation regarding the FetchPlans feature for our next release and we will include information about ParallelFetch. Meanwhile if you have any suggestions about how to improve our documentation, or if you note any missing content, do not hesitate to share with us - we will be very grateful.

Best wishes,
Pencho
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
John
Top achievements
Rank 1
Answers by
Jan Blessenohl
Telerik team
John
Top achievements
Rank 1
Pencho
Telerik team
Share this question
or