Prefetch subpath behavior

Posts   
 
    
ThePirate
User
Posts: 7
Joined: 18-Dec-2007
# Posted on: 22-Jan-2009 16:08:02   

Database: Oracle 10g LLBLGen Pro: v2.5 .NET Framework: 2.0

Ihave a prefetch path2 like this

IPrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.CustomerEntity);
                prefetchPath.Add(CustomerEntity.PrefetchPathProduct)
                    .SubPath.Add(Product.PrefetchPathProduct, 0,ProductArticles.PredicateExpression, filterDeb.Relations)
                    .SubPath.Add(ProductArticlesEntity.PrefetchPathArticlesPrice, 0, filterArticlePrice.PredicateExpression)
                    .SubPath.Add(ArticlePrice.PrefetchPathKand); 

prefetchPath.Add(CustomerEntity.PrefetchPathAddress);
prefetchPath.Add(CustomerEntity.PrefetchPathContactPerson);

Then we fetch this data with the following code

if (criteria.MaxRecords.HasValue)
                        db.FetchEntityCollection(Customers, filter, MaxRecords, null, prefetchPath);

When we set the Maxrecords to 50,he generates a parameter list and executes everything correct, but when we set the value to 100 the system generated additional queries to retrieve the Id's without any limitation.

Query: SELECT "CUSTOMER"."ID" AS "Id" FROM "CUSTOMER" WHERE ( ( ( UPPER(TRIM("CUSTOMER"."CUSTOMER_TYPE")) = UPPER(TRIM(:LOfb52893a1))))) Parameter: :LOfb52893a1 : String. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: "EXT".

Does anybody knows the reason of this strange behavoir. confused

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Jan-2009 03:49:04   

What is the type of the relations (1:1, 1:n, m:1)? I think this have to do with Optimizing Prefetch Paths.

David Elizondo | LLBLGen Support Team
ThePirate
User
Posts: 7
Joined: 18-Dec-2007
# Posted on: 23-Jan-2009 14:44:42   

Hi, It's always the same. Just when I post a thread I find the solution.

DataAccessAdapter.ParameterisedPrefetchPathThreshold was set to 50 (the default value) and I set the maximum returned rows to 150.

When I changed the DataAccessAdapter.ParameterisedPrefetchPathThreshold to 150 everything worked just fine.

Cheers