Single Entity fetch with pre-fetch paths and join hints...

Posts   
 
    
Posts: 32
Joined: 01-Oct-2007
# Posted on: 29-Apr-2008 13:37:15   

Using Adapter.

Table Structure: Product -> Product Version -> Fixed Issue.

Not all versions have fixed issues. What I want is to retrieve a single product with all of its version regardless of if they have any fixed issues, and all of the fixed issues if there are any.

At the moment I am doing

PrefetchPath2 pfp = new PrefetchPath2(EntityType.ProductEntity );

           pfp.Add(ProductEntity.PrefetchPathProductVersion )
                .SubPath.Add(ProductVersionEntity.PrefetchPathFixedIssue);

          DA.FetchEntity(product, pfp);

This is only giving me inner joins so if a version does not have any issues it is not returned. How do I specify a left join hint for this query...?

Thanks

Matt

goose avatar
goose
User
Posts: 392
Joined: 06-Aug-2007
# Posted on: 29-Apr-2008 18:58:54   

Hi, could you please post the sql- query so we can help you better.

Posts: 32
Joined: 01-Oct-2007
# Posted on: 30-Apr-2008 16:00:32   

goose wrote:

Hi, could you please post the sql- query so we can help you better.

It would be something like

Select * from Product INNER JOIN ProductVersion.. LEFT JOIN FixedIssue

So the entity graph I get back shoud look like this

Product 1 ProductVersion1 FixedIssue1 FixedIssue2 ProductVersion2 ProductVersion3 FixedIssue3

What I get at the moment is

Product 1 ProductVersion1 FixedIssue1 FixedIssue2 ProductVersion3 FixedIssue3

As ProductVersion2 does not have any fixed issues...

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 30-Apr-2008 16:22:33   

You must be mistaken, as no JOINs are used with PrefetchPaths. Using the prefetchPath code you specified should perfectly return what you need.

To be sure please inspect the generated SQL queries. for more info please consult the manual's section: "Using the generated code - Troubleshooting and debugging"

Posts: 32
Joined: 01-Oct-2007
# Posted on: 30-Apr-2008 17:26:49   

Walaa wrote:

You must be mistaken, as no JOINs are used with PrefetchPaths. Using the prefetchPath code you specified should perfectly return what you need.

that's what I thought so I was a little bit puzzled by the request from your support person...

I was expecting pre-fetch paths to give me the result I was after - I'll check the code and the sql trace and investigate further....

Matt