Yes. See test fixture at
https://github.com/diegose/NHibernate.Diegose/blob/master/NodaTime/Test/LocalDateFixture.cs


On Thu, May 30, 2013 at 9:02 AM, Alexander I. Zaytsev <[email protected]>wrote:

> Ok,
> does this query work in HQL?
>
>
> 2013/5/30 Diego Mijelshon <[email protected]>
>
>> Alex - that's what the NHibernate.NodaTime project is about! :-)
>> I'll wait 'til you re-read my original email...
>> ...ok, we're back :-)
>> So, the problem is, my type works fine for most operations (schema
>> creation, CRUD, HQL, and LINQ queries that include the properties as
>> scalar). But aggregations fail because the tree includes an "HqlIdent",
>> which I have no idea what represents, but is hardcoded for primitive types.
>>
>>
>> On Wed, May 29, 2013 at 8:34 PM, Alexander I. Zaytsev 
>> <[email protected]>wrote:
>>
>>> I mean create a IUserType to handle NodaTime and register it in mapping.
>>>
>>> Regards,
>>> Alex
>>>
>>>
>>> 2013/5/29 Diego Mijelshon <[email protected]>
>>>
>>>> Register where, Alex?
>>>>
>>>>
>>>> On Tue, May 28, 2013 at 7:31 PM, Alexander I. Zaytsev <[email protected]
>>>> > wrote:
>>>>
>>>>> Hi Diego,
>>>>>
>>>>> Probably you need to register usertype for nodatime.
>>>>>
>>>>> Regards,
>>>>> Alex
>>>>>
>>>>>
>>>>> 2013/5/29 Diego Mijelshon <[email protected]>
>>>>>
>>>>>> session.Query<Foo>().Max(x => x.Date);
>>>>>>
>>>>>> This is the full code of the method I did not commit in
>>>>>> LocalDateFixture:
>>>>>>
>>>>>>
>>>>>>         [Test]
>>>>>>         public void ValuesCanBeRetrievedFromLinqQueries()
>>>>>>         {
>>>>>>             object id;
>>>>>>             using (var session = sessionFactory.OpenSession())
>>>>>>             using (var tx = session.BeginTransaction())
>>>>>>             {
>>>>>>                 id = session.Save(new Foo { Date = someDate });
>>>>>>                 tx.Commit();
>>>>>>             }
>>>>>>             using (var session = sessionFactory.OpenSession())
>>>>>>             using (var tx = session.BeginTransaction())
>>>>>>             {
>>>>>>                 var maxDate = session.Query<Foo>().Max(x => x.Date);
>>>>>>                 Assert.AreEqual(someDate, maxDate);
>>>>>>             }
>>>>>>         }
>>>>>>
>>>>>>
>>>>>> Thanks
>>>>>> Diego
>>>>>>
>>>>>>
>>>>>> On Mon, May 27, 2013 at 11:13 PM, Alexander I. Zaytsev <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Hi Diego,
>>>>>>>
>>>>>>> Can you please provide a query?
>>>>>>>
>>>>>>> Regards,
>>>>>>> Alexander
>>>>>>>
>>>>>>>
>>>>>>> 2013/5/28 Diego Mijelshon <[email protected]>
>>>>>>>
>>>>>>>>  Hi guys.
>>>>>>>>
>>>>>>>> I'm trying to implement some NodaTime mapping support for NH.
>>>>>>>> This is in a proof-of-concept state now, but there's already a
>>>>>>>> Nuget package, NHibernate.NodaTime. You can check it out.
>>>>>>>> Here's one of the first roadblocks I've found: when trying to query
>>>>>>>> using LINQ aggregate methods, I run into the following exception:
>>>>>>>>
>>>>>>>> System.NotSupportedException : Don't currently support idents of
>>>>>>>> type LocalDate
>>>>>>>>    at NHibernate.Hql.Ast.HqlIdent..ctor(IASTFactory factory, Type
>>>>>>>> type)
>>>>>>>>    at NHibernate.Hql.Ast.HqlCast..ctor(IASTFactory factory,
>>>>>>>> HqlExpression expression, Type type)
>>>>>>>>    at NHibernate.Hql.Ast.HqlTreeBuilder.Cast(HqlExpression
>>>>>>>> expression, Type type)
>>>>>>>>    at
>>>>>>>> NHibernate.Linq.Visitors.HqlGeneratorExpressionTreeVisitor.VisitNhMax(NhMaxExpression
>>>>>>>> expression)
>>>>>>>>    at
>>>>>>>> NHibernate.Linq.Visitors.HqlGeneratorExpressionTreeVisitor.VisitExpression(Expression
>>>>>>>> expression)
>>>>>>>>    at
>>>>>>>> NHibernate.Linq.Visitors.HqlGeneratorExpressionTreeVisitor.Visit(Expression
>>>>>>>> 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.Clauses.SelectClause.Accept(IQueryModelVisitor
>>>>>>>> visitor, QueryModel queryModel)
>>>>>>>>    at
>>>>>>>> Remotion.Linq.QueryModelVisitorBase.VisitQueryModel(QueryModel 
>>>>>>>> queryModel)
>>>>>>>>    at NHibernate.Linq.Visitors.QueryModelVisitor.Visit()
>>>>>>>>    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.HQLExpressionQueryPlan..ctor(String
>>>>>>>> expressionStr, IQueryExpression queryExpression, String collectionRole,
>>>>>>>> Boolean shallow, IDictionary`2 enabledFilters, 
>>>>>>>> ISessionFactoryImplementor
>>>>>>>> factory)
>>>>>>>>    at NHibernate.Engine.Query.HQLExpressionQueryPlan..ctor(String
>>>>>>>> expressionStr, IQueryExpression queryExpression, 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.PrepareQuery(Expression
>>>>>>>> expression, ref IQuery query, ref NhLinqExpression nhQuery)
>>>>>>>>    at NHibernate.Linq.DefaultQueryProvider.Execute(Expression
>>>>>>>> expression)
>>>>>>>>    at NHibernate.Linq.DefaultQueryProvider.Execute(Expression
>>>>>>>> expression)
>>>>>>>>    at System.Linq.Queryable.Max(IQueryable`1 source, Expression`1
>>>>>>>> selector)
>>>>>>>>    at [my code]
>>>>>>>>
>>>>>>>> It looks like the Hql Ast generation fails for anything that is not
>>>>>>>> a native type.
>>>>>>>> Is there a workaround from the Linq side (generators) or do I have
>>>>>>>> to patch the core?
>>>>>>>>
>>>>>>>> Thanks!
>>>>>>>> Diego
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> ---
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "nhibernate-development" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>> send an email to
>>>>>>>> [email protected].
>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>  --
>>>>>>>
>>>>>>> ---
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "nhibernate-development" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to [email protected]
>>>>>>> .
>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>  --
>>>>>>
>>>>>> ---
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "nhibernate-development" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>  --
>>>>>
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "nhibernate-development" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>
>>>>>
>>>>>
>>>>
>>>>  --
>>>>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "nhibernate-development" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>
>>>  --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "nhibernate-development" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "nhibernate-development" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nhibernate-development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to