System.NotSupportedException : Don't currently support idents of type DateTimeOffset

Description

I'm still not sure which part of this query causing it (is it the OrderBy or the projection), but here's the failing query:

session.Query<Transaction>()
.OrderBy(transaction => transaction.Postings.Min(y => y.Date));

The issue lies in HqlIdent constructor.
It uses System.TypeCode, but unfortunately, there's no definition TypeCode.DateTimeOffset.
I think a possible fix is by checking System.Type directly like Guid (type == typeof(Guid)), instead of checking using TypeCode.

Stack trace:

System.NotSupportedException : Don't currently support idents of type DateTimeOffset
at NHibernate.Hql.Ast.HqlIdent..ctor(IASTFactory factory, Type type)
at NHibernate.Hql.Ast.HqlCast..ctor(IASTFactory factory, HqlExpression expression, Type type)
at NHibernate.Linq.Visitors.HqlGeneratorExpressionTreeVisitor.VisitNhMin(NhMinExpression expression)
at NHibernate.Linq.Visitors.SelectClauseVisitor.VisitExpression(Expression expression)
at NHibernate.Linq.Visitors.SelectClauseVisitor.Visit(Expression expression)
at NHibernate.Linq.Visitors.QueryModelVisitor.VisitSelectClause(SelectClause selectClause, QueryModel queryModel)
at Remotion.Linq.QueryModelVisitorBase.VisitQueryModel(QueryModel queryModel)
at NHibernate.Linq.Visitors.QueryModelVisitor.GenerateHqlQuery(QueryModel queryModel, VisitorParameters parameters, Boolean root)
at NHibernate.Linq.Visitors.HqlGeneratorExpressionTreeVisitor.VisitSubQueryExpression(SubQueryExpression expression)
at NHibernate.Linq.Visitors.QueryModelVisitor.VisitOrderByClause(OrderByClause orderByClause, QueryModel queryModel, Int32 index)
at Remotion.Linq.QueryModelVisitorBase.VisitBodyClauses(ObservableCollection`1 bodyClauses, QueryModel queryModel)
at Remotion.Linq.QueryModelVisitorBase.VisitQueryModel(QueryModel queryModel)
at NHibernate.Linq.Visitors.QueryModelVisitor.GenerateHqlQuery(QueryModel queryModel, VisitorParameters parameters, Boolean root)
at NHibernate.Linq.NhLinqExpression.Translate(ISessionFactoryImplementor sessionFactory)
at NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(String queryIdentifier, IQueryExpression queryExpression, String collectionRole, Boolean shallow, IDictionary`2 filters, ISessionFactoryImplementor factory)
at NHibernate.Engine.Query.HQLExpressionQueryPlan.CreateTranslators(String expressionStr, IQueryExpression queryExpression, String collectionRole, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory)
at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow, IDictionary`2 enabledFilters)
at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow)
at NHibernate.Impl.AbstractSessionImpl.CreateQuery(IQueryExpression queryExpression)
at NHibernate.Linq.DefaultQueryProvider.ExecuteFuture(Expression expression)
at NHibernate.Linq.LinqExtensionMethods.ToFuture(IQueryable`1 query)

Environment

None

Activity

Show:

Alex Zaytsev 
September 8, 2014 at 11:31 AM

Close issues resolved in 3.3.3

Oskar Berggren 
March 22, 2013 at 7:58 AM

Thanks for confirming.

Maximilian Haru Raditya 
March 22, 2013 at 6:45 AM

I confirm this has been fixed in 3.3.3 GA.

Thanks, Oskar!

Oskar Berggren 
December 16, 2012 at 5:19 PM

Fixed (6b0476ae0aba76e89bd2606103af2a82085f319e).

Maximilian Haru Raditya 
December 12, 2012 at 2:02 PM

Actually, I'm asking first whether it'd be right thing to do, as I really have no clear idea what it's about. But I'll try to create a fix, to see if it would work, as I find time this weekend.
Any ETA for 3.3.3?

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created December 11, 2012 at 10:33 AM
Updated September 8, 2014 at 11:31 AM
Resolved December 16, 2012 at 5:19 PM
Who's Looking?