Skip to content

NH-3445 - Select, Distinct, OrderBy, Take fails with NotSupportedException #1304

Open
@nhibernate-bot

Description

@nhibernate-bot

Mark Junker created an issue — 9th April 2013, 8:57:32:

A combination of Select, Distinct, OrderBy and Take fails with a NotSupportedException with the following stack trace:

       bei NHibernate.Hql.Ast.ANTLR.PolymorphicQuerySourceDetector.GetClassName(IASTNode querySource) in c:\Users\Mark\Desktop\nhcore\src\NHibernate\Hql\Ast\ANTLR\PolymorphicQuerySourceDetector.cs:Zeile 59.
       bei NHibernate.Hql.Ast.ANTLR.PolymorphicQuerySourceDetector.Process(IASTNode tree) in c:\Users\Mark\Desktop\nhcore\src\NHibernate\Hql\Ast\ANTLR\PolymorphicQuerySourceDetector.cs:Zeile 27.
       bei NHibernate.Hql.Ast.ANTLR.AstPolymorphicProcessor.Process() in c:\Users\Mark\Desktop\nhcore\src\NHibernate\Hql\Ast\ANTLR\AstPolymorphicProcessor.cs:Zeile 30.
       bei NHibernate.Hql.Ast.ANTLR.AstPolymorphicProcessor.Process(IASTNode ast, ISessionFactoryImplementor factory) in c:\Users\Mark\Desktop\nhcore\src\NHibernate\Hql\Ast\ANTLR\AstPolymorphicProcessor.cs:Zeile 24.
       bei NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(IASTNode ast, String queryIdentifier, String collectionRole, Boolean shallow, IDictionary`2 filters, ISessionFactoryImplementor factory) in c:\Users\Mark\Desktop\nhcore\src\NHibernate\Hql\Ast\ANTLR\ASTQueryTranslatorFactory.cs:Zeile 29.
       bei NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(IQueryExpression queryExpression, String collectionRole, Boolean shallow, IDictionary`2 filters, ISessionFactoryImplementor factory) in c:\Users\Mark\Desktop\nhcore\src\NHibernate\Hql\Ast\ANTLR\ASTQueryTranslatorFactory.cs:Zeile 24.
       bei NHibernate.Engine.Query.QueryExpressionPlan.CreateTranslators(IQueryExpression queryExpression, String collectionRole, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) in c:\Users\Mark\Desktop\nhcore\src\NHibernate\Engine\Query\QueryExpressionPlan.cs:Zeile 25.
       bei NHibernate.Engine.Query.QueryExpressionPlan..ctor(IQueryExpression queryExpression, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) in c:\Users\Mark\Desktop\nhcore\src\NHibernate\Engine\Query\QueryExpressionPlan.cs:Zeile 12.
       bei NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow, IDictionary`2 enabledFilters) in c:\Users\Mark\Desktop\nhcore\src\NHibernate\Engine\Query\QueryPlanCache.cs:Zeile 67.
       bei NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow) in c:\Users\Mark\Desktop\nhcore\src\NHibernate\Impl\AbstractSessionImpl.cs:Zeile 412.
       bei NHibernate.Impl.AbstractSessionImpl.CreateQuery(IQueryExpression queryExpression) in c:\Users\Mark\Desktop\nhcore\src\NHibernate\Impl\AbstractSessionImpl.cs:Zeile 372.
       bei NHibernate.Linq.DefaultQueryProvider.PrepareQuery(Expression expression, IQuery& query, NhLinqExpression& nhQuery) in c:\Users\Mark\Desktop\nhcore\src\NHibernate\Linq\DefaultQueryProvider.cs:Zeile 70.
       bei NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression) in c:\Users\Mark\Desktop\nhcore\src\NHibernate\Linq\DefaultQueryProvider.cs:Zeile 34.
       bei NHibernate.Linq.DefaultQueryProvider.Execute<TResult>(Expression expression) in c:\Users\Mark\Desktop\nhcore\src\NHibernate\Linq\DefaultQueryProvider.cs:Zeile 41.
       bei Remotion.Linq.QueryableBase`1.System.Collections.IEnumerable.GetEnumerator()

I'll add a patch for a test case.


Mark Junker added a comment — 9th April 2013, 9:04:53:

Test case for master/head


Alexander Zaytsev added a comment — 27th February 2014, 2:07:21:

The problem in HQL


om2804 added a comment — 23rd December 2016, 12:21:00:

I use Select().OrderBy().Distinct() instead Select().Distinct().OrderBy(). It solved my problem with throw NotSupportedException

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions