Hi everyone,
I'm trying to perform a count(*) along the lines of (psuedo-sql):
Code:
SELECT count(*) FROM GrandChildEntity WHERE ChildEntity.Entity.String = 'foo'
When the implicit join is only one deep (i.e. FROM ChildEntity WHERE Entity.String = 'foo') then all is fine and I get a query which looks like:
Code:
SELECT count(*) as y0_ FROM IChildEntity this_
inner join IEntity entity1_ on
this_.Entity=entity1_.Id WHERE entity1_.String = ?}
However, when I alias the grandchild, the inner join is not getting generated so the query fails:
Code:
SELECT count(*) as y0_ FROM IGrandChildEntity this_ WHERE childentit1_.String = @p0
Do I need to treat deep joins differently when creating the criteria (doing it using ICritera API)? Looking through the code, CriteriaJoinWalker.GetJoinType() will always return null (when I think it should return Join) because the alias path is not a direct association and the query contains a 'count()' projection.
Performing a select operation using the same criteria works.
Many thanks for any help with this,
Will Holley