Hi, thanks, that was the problem. On Nov 5, 5:38 am, Adam Bar <[email protected]> wrote: > Are you sure you want to do ordering *after* taking first 5 rows? If > so, do it in-process: > > Session.Query<Foo>() > .Where(x => x.Code == "testcode") > .Where(x => x.Bar.Id = 7) > .Take(5) > .AsEnumerable() > .OrderBy(x => x.Name) > .ThenBy(x => x.Code) > .ToList(); > > Alternatively, if you want to take first 5 rows respecting the > ordering by Name and Code, move Take() to the end (as it is processed > in the db): > > Session.Query<Foo>() > .Where(x => x.Code == "testcode") > .Where(x => x.Bar.Id = 7) > .OrderBy(x => x.Name) > .ThenBy(x => x.Code) > .Take(5) > .ToList(); > > A. > > On 4 Lis, 04:41, acl123 <[email protected]> wrote: > > > > > > > > > Hi, > > I'm upgrading from NHibernate 2.1.2 to 3.2.0. > > > We were using a the Linq provider a lot so I am making converting to > > the new built-in Linq provider. > > > The following query is throwing a not supported exception: > > > Session.Query<Foo>() > > .Where(x => x.Code == "testcode") > > .Where(x => x.Bar.Id = 7) > > .Take(5) > > .OrderBy(x => x.Name) > > .ThenBy(x => x.Code) > > .ToList(); > > > Removing the Take() fixes the issue. > > > The full stack trace is: > > at > > NHibernate.Hql.Ast.ANTLR.PolymorphicQuerySourceDetector.GetClassName(IASTNo > > de > > querySource) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Hql\Ast\ANTLR > > \PolymorphicQuerySourceDetector.cs: line 58 > > at > > NHibernate.Hql.Ast.ANTLR.PolymorphicQuerySourceDetector.Process(IASTNode > > tree) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Hql\Ast\ANTLR > > \PolymorphicQuerySourceDetector.cs: line 25 > > at NHibernate.Hql.Ast.ANTLR.AstPolymorphicProcessor.Process() in d: > > \CSharp\NH\NH\nhibernate\src\NHibernate\Hql\Ast\ANTLR > > \AstPolymorphicProcessor.cs: line 30 > > at > > NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(I > > ASTNode > > ast, String queryIdentifier, String collectionRole, Boolean shallow, > > IDictionary`2 filters, ISessionFactoryImplementor factory) in d:\CSharp > > \NH\NH\nhibernate\src\NHibernate\Hql\Ast\ANTLR > > \ASTQueryTranslatorFactory.cs: line 33 > > at > > NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(S > > tring > > queryIdentifier, IQueryExpression queryExpression, String > > collectionRole, Boolean shallow, IDictionary`2 filters, > > ISessionFactoryImplementor factory) in d:\CSharp\NH\NH\nhibernate\src > > \NHibernate\Hql\Ast\ANTLR\ASTQueryTranslatorFactory.cs: line 27 > > at > > NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(IQueryExpression > > queryExpression, Boolean shallow, IDictionary`2 enabledFilters) in d: > > \CSharp\NH\NH\nhibernate\src\NHibernate\Engine\Query > > \QueryPlanCache.cs: line 88 > > at > > NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(IQueryExpression > > queryExpression, Boolean shallow) in d:\CSharp\NH\NH\nhibernate\src > > \NHibernate\Impl\AbstractSessionImpl.cs: line 312 > > at NHibernate.Impl.AbstractSessionImpl.CreateQuery(IQueryExpression > > queryExpression) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl > > \AbstractSessionImpl.cs: line 268 > > at NHibernate.Linq.DefaultQueryProvider.PrepareQuery(Expression > > expression, ref IQuery query, ref NhLinqExpression nhQuery) in d: > > \CSharp\NH\NH\nhibernate\src\NHibernate\Linq\DefaultQueryProvider.cs: > > line 69 > > at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression) > > in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Linq > > \DefaultQueryProvider.cs: line 33 > > at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression) > > in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Linq > > \DefaultQueryProvider.cs: line 40 > > at Remotion.Linq.QueryableBase`1.GetEnumerator() in :line 0
-- 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.
