Thanks Fabio - I figured that was the case. Are you entering a bug report, or are you asking me to?
Also, do you have any thoughts on workarounds other than what I suggested? Thanks, Kent On Sep 30, 4:22 pm, Fabio Maulo <[email protected]> wrote: > it should be a bug > > 2009/9/30 Kent Boogaart <[email protected]> > > > > > > > 2.1.0.GA. > > > On Sep 30, 3:58 pm, Fabio Maulo <[email protected]> wrote: > > > NH version ? > > > > 2009/9/30 Kent Boogaart <[email protected]> > > > > > Hi all, > > > > > The following HQL works: > > > > > select Something, cast(((Something + 50) / 20) as int) from > > > > Somewhere > > > > > The following does not: > > > > > select Something, cast(((Something + 50) / :divisor) as int) from > > > > Somewhere > > > > > The only difference is that I attempt to swap in a parameter rather > > > > than hard-coding the divisor. I get the following exception when > > > > attempting to create the query with a parameter and cast combination: > > > > > NHibernate.QueryException: invalid Hibernate type for cast(): type ? > > > > int not found [select Something, cast(((Something + 50) / :divisor) as > > > > int) from Somewhere] > > > > at NHibernate.Dialect.Function.CastFunction.Render(IList args, > > > > ISessionFactoryImplementor factory) > > > > at NHibernate.Hql.Ast.ANTLR.SqlGenerator.EndFunctionTemplate > > > > (IASTNode m) > > > > at NHibernate.Hql.Ast.ANTLR.SqlGenerator.methodCall() > > > > at NHibernate.Hql.Ast.ANTLR.SqlGenerator.selectExpr() > > > > at NHibernate.Hql.Ast.ANTLR.SqlGenerator.selectColumn() > > > > at NHibernate.Hql.Ast.ANTLR.SqlGenerator.selectClause() > > > > at NHibernate.Hql.Ast.ANTLR.SqlGenerator.selectStatement() > > > > at NHibernate.Hql.Ast.ANTLR.SqlGenerator.statement() > > > > at NHibernate.Hql.Ast.ANTLR.HqlSqlGenerator.Generate() > > > > at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.DoCompile > > > > (IDictionary`2 replacements, Boolean shallow, String collectionRole) > > > > at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.Compile > > > > (IDictionary`2 replacements, Boolean shallow) > > > > at NHibernate.Engine.Query.HQLQueryPlan..ctor(String hql, String > > > > collectionRole, Boolean shallow, IDictionary`2 enabledFilters, > > > > ISessionFactoryImplementor factory) > > > > at NHibernate.Engine.Query.HQLQueryPlan..ctor(String hql, Boolean > > > > shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor > > > > factory) > > > > at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(String > > > > queryString, Boolean shallow, IDictionary`2 enabledFilters) > > > > at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(String > > > > query, Boolean shallow) > > > > at NHibernate.Impl.AbstractSessionImpl.CreateQuery(String > > > > queryString) > > > > > Can anyone suggest how I can get this to work, preferably with a > > > > parameter? Worst-case is that I have to forgo the parameter and > > > > dynamically construct the HQL, which obviously inhibits the ability of > > > > the DB to cache an execution plan for my query. > > > > > Thanks, > > > > Kent > > > > -- > > > Fabio Maulo > > -- > Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
