Retrive specific child objects via OGL or use Fetch groups?

Thread is closed for posting
2 posts, 0 answers
  1. G
    G avatar
    14 posts
    Member since:
    May 2009

    Posted 08 Nov 2009 Link to this post


    I'm new to OA so not sure of the best way to tackle the following simplified scenario.

    I have a parent entity that contains several collections of differing child types.

    I want to only populate the child types based on various criteria. For instance just get the children of a parent entity that are between a date range. 

    I can't figure out how to do this in ogl. I can't see how the child is linked back to the parent, there isn't an id field present in the child entity.

    I looked at fetch groups but we have a large amount of data and we know at runtime what subsets we need so thought it would be easier to query the related child entities and just bring into scope the data we require.

    In straight SQL I would do this like:
        child ch  
    inner join 
        parent_child pc  
    on  pc.child_id = ch.child_id  
    inner join 
        parent p  
    on  p.parent_id = pc.parent_id  
        p.project_id = 20 

  2. Damyan Bogoev
    Damyan Bogoev avatar
    581 posts

    Posted 09 Nov 2009 Link to this post

    Hi G,

    You could use the existing object references. Most probably in your child object you have a reference to the parent. You can use it to navigate to the project id of the parent. In OQL, the query you provided, would look like this:
    IQuery query = scope.GetOqlQuery("SELECT * FROM ChildExtent AS ch WHERE ch.Parent_child.Parent.Project_id == 20");

    I hope that helps you.

    Damyan Bogoev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top