Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> CorrelatedOver using inheritance when not required
 

Pages: 1
LLBLGen Pro Runtime Framework
CorrelatedOver using inheritance when not required
Page:1/1 

  Print all messages in this thread  
Poster Message
simmotech
User



Location:

Joined on:
01-Feb-2006 15:43:00
Posted:
1006 posts
# Posted on: 07-Feb-2018 20:23:06.  
Code:
            var query = qf.ClassGroup
                .Select(
                    ClassGroupFields.ID,
                    ClassGroupFields.Name,
                    ClassGroupFields.YearGroup,
                    ClassGroupFields.TeacherID,
                    ClassGroupFields.Teacher2ID,
                    ClassGroupFields.AssistantID,
                    ClassGroupFields.Assistant2ID,
                    ClassGroupFields.Email,
                    ClassGroupFields.IsFinesActive,
                    [b]qf.User[/b].CorrelatedOver(UserFields.ClassGroupID == ClassGroupFields.ID).CountRow().As(CountFieldName)
                );


This is the query I want to run but the SQL generated uses "Borrower" rather than the "User" highlighted in bold). Borrower is a sub-type of User but the relation to ClassGroup is on User.
I also tried the CorrelatedOver overload that takes a relationship but get the same problem.

I have used this type of CorrelatedOver construct before without any problem..

Code:
            var query = qf.Keyword
                .OrderBy(KeywordFields.Phrase | SortOperator.Ascending)
                .Select(
                    KeywordFields.ID,
                    KeywordFields.Phrase,
                    qf.ResourceToKeyword.CorrelatedOver(ResourceToKeywordFields.KeywordID == KeywordFields.ID).CountRow().As(CountFieldName)
                );


the only difference being that this query has no inheritance on ResourceToKeyword.

  Top
simmotech
User



Location:

Joined on:
01-Feb-2006 15:43:00
Posted:
1006 posts
# Posted on: 07-Feb-2018 20:23:49.  
LLBLGen 4.2 and this is the resulting SQL

Code:
SELECT
[ClassGroup].[ID],
[ClassGroup].[Name],
[ClassGroup].[YearGroup],
[ClassGroup].[TeacherID],
[ClassGroup].[Teacher2ID],
[ClassGroup].[AssistantID],
[ClassGroup].[Assistant2ID],
[ClassGroup].[Email],
[ClassGroup].[IsFinesActive],
(
SELECT
COUNT(*) AS [LPAV_]
FROM
[Borrower]
WHERE
( [User].[ClassGroupID] = [ClassGroup].[ID])) AS [Count]
FROM
[ClassGroup]


  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14484 posts
# Posted on: 08-Feb-2018 16:19:18.  
Which LLBLGen runtime library version are you using?
  Top
simmotech
User



Location:

Joined on:
01-Feb-2006 15:43:00
Posted:
1006 posts
# Posted on: 08-Feb-2018 16:21:32.  
4.2 as per last message. 4.2.15.309 to be exact


  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14484 posts
# Posted on: 08-Feb-2018 16:26:37.  
Could you please try the latest release of v.4.2?
  Top
simmotech
User



Location:

Joined on:
01-Feb-2006 15:43:00
Posted:
1006 posts
# Posted on: 08-Feb-2018 16:44:05.  
Is there a fix in there for this as a known problem?

(I'm really not in a position to change things on the off-chance at the moment. And I will be moving to 5.3 when I have some time)


  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14484 posts
# Posted on: 08-Feb-2018 16:46:14.  
I'm suspecting a bug fix that might be related to this issue.
That's why I'm suggesting the latest release.

At least you can give it a try in a copy of your project.
  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37476 posts
# Posted on: 09-Feb-2018 09:32:49.  
Could be this fix:
Fix     Runtime Libraries 4.2     07082015     08-Jul-2015     QuerySpec: In some cases a correlation predicate wasn't properly wrapped as a correlation predicate which could lead to problems when the correlation predicate was used on a nested query with inheritance inside exists (and related operators) queries.



Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.