I think I remember seeing something like this reported in the issue
tracker. (nhibernate.jira.com).

/Oskar


2012/1/24 LOBOMINATOR <[email protected]>:
> Hello Together,
>
> In production we are using Sql Server 2008 Express R2. To enable
> testing of our queries etc. we are using Sql Compact 4.0 in our
> continuously running tests. We wrote some customization to support
> DateTimeOffset for Sql Compact edition. But the rest is kept at its
> defaults. This worked very nice until we introduced subqueries and
> inheritance hierarchies. The following issue occurs:
>
> Lets say we have
> public class Person { public virtual Name { get; set; } }
> public class Employee : Person { }
> public class ExEmployee: Person { }
>
> when we want to write a query which returns the count of employees and
> the count of exemployees the compact server explodes when we write it
> with futures or subqueries:
>
>            Person person = null;
>            PersonDTO personDTO = null;
>
>            var employeeCount = session.QueryOver<Employee>()
>                .Where(t => t.Company.Id == this.companyId)
>                .Select(Projections.RowCount())
>                .FutureValue<int>();
>
>            var exEmployeeCount = session.QueryOver<ExEmployee>()
>                .Where(t => t.Company.Id == this.companyId)
>                .Select(Projections.RowCount())
>                .FutureValue<int>();
>
>            return session.QueryOver(() => orderAlias)
>                .Where(o => o.Id == this.orderId)
>                .Select(
>
> Projections.Constant(employeeCount.Value).WithAlias(() =>
> personDTO .NumberOfEmployees),
>
> Projections.Constant(exEmployeeCount.Value).WithAlias(() => personDTO
> NumberOfExEmployees),
>                    ...)
>                .TransformUsing(Transformers.AliasToBean<PersonDTO
>>())
>                .SingleOrDefault<PersonDTO >();
>
> or
>
> var employeeCount = QueryOver.Of<Employee>()
>     .Where(w => w.Company.Id == this.companyId)
>     .Select(Projections.RowCount()));
>
> var exEmployeeCount = QueryOver.Of<ExEmployee>()
>     .Where(w => w.Company.Id == this.companyId)
>     .Select(Projections.RowCount()));
>
> return session.QueryOver(() => person)
>    .Select(
> Projections.SubQuery(employeeCount ).WithAlias(() =>
> personDTO.NumberOfEmployees),
> Projections.SubQuery(exEmployeeCount ).WithAlias(() =>
> personDTO.NumberOfExEmployees))
> TransformUsing(Transformers.AliasToBean<PersonDTO>())
> Future<PersonDTO>();
>
> We get a SqlCe parse exception with either cannot create multicriteria
> (in case of futures) or SqlCe exception with only parse exception.
>
> The only solution we have so far is to write three queries without
> futures or subqueries. Any suggestions how could overcome this issue
> without moving away from SqlCompact to SqlServer in our tests?
>
> Daniel
>
> --
> You received this message because you are subscribed to the Google Groups 
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/nhusers?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to