Hi guys,

I'm writing a query like this off the current trunk.

return _query.PublisherZoneStatsView
                .GroupBy(t=>t.PublisherName)
                .Select(t=>new StatsSummary
                               {
                                   PublisherName = t.Key,
                                   Revenue = t.Sum(x => x.Revenue)
                               }
                )
                .ToList();

The underlying database is MySQL, and the underlying column type for
"Revenue" is decimal(10,4).

When mapped as an integer, the query works fine. However, when I map the
"Revenue" property as an decimal (or double), then I get the stack trace
below. Doing the same select without the group by or sum works fine.

[ArgumentException: Dialect does not support DbType.Decimal
Parameter name: typecode]
   NHibernate.Dialect.TypeNames.Get(DbType typecode) in
..\nhsrc\Dialect\TypeNames.cs:62
   NHibernate.Dialect.MySQLDialect.GetCastTypeName(SqlType sqlType) in
..\nhsrc\Dialect\MySQLDialect.cs:304
   NHibernate.Dialect.Function.CastFunction.Render(IList args,
ISessionFactoryImplementor factory) in
..\nhsrc\Dialect\Function\CastFunction.cs:54
   NHibernate.Hql.Ast.ANTLR.SqlGenerator.EndFunctionTemplate(IASTNode m) in
..\nhsrc\Hql\Ast\ANTLR\SqlGenerator.cs:304
   NHibernate.Hql.Ast.ANTLR.SqlGenerator.methodCall() in
..\nhsrc\Hql\Ast\ANTLR\Generated\SqlGenerator.cs:5532
   NHibernate.Hql.Ast.ANTLR.SqlGenerator.selectExpr() in
..\nhsrc\Hql\Ast\ANTLR\Generated\SqlGenerator.cs:1900
   NHibernate.Hql.Ast.ANTLR.SqlGenerator.selectColumn() in
..\nhsrc\Hql\Ast\ANTLR\Generated\SqlGenerator.cs:1662
   NHibernate.Hql.Ast.ANTLR.SqlGenerator.selectClause() in
..\nhsrc\Hql\Ast\ANTLR\Generated\SqlGenerator.cs:1609
   NHibernate.Hql.Ast.ANTLR.SqlGenerator.selectStatement() in
..\nhsrc\Hql\Ast\ANTLR\Generated\SqlGenerator.cs:473
   NHibernate.Hql.Ast.ANTLR.SqlGenerator.statement() in
..\nhsrc\Hql\Ast\ANTLR\Generated\SqlGenerator.cs:403
   NHibernate.Hql.Ast.ANTLR.HqlSqlGenerator.Generate() in
..\nhsrc\Hql\Ast\ANTLR\QueryTranslatorImpl.cs:634
   NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.DoCompile(IDictionary`2
replacements, Boolean shallow, String collectionRole) in
..\nhsrc\Hql\Ast\ANTLR\QueryTranslatorImpl.cs:376

NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(IASTNode
ast, String queryIdentifier, String collectionRole, Boolean shallow,
IDictionary`2 filters, ISessionFactoryImplementor factory) in
..\nhsrc\Hql\Ast\ANTLR\ASTQueryTranslatorFactory.cs:43

NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(String
queryIdentifier, IQueryExpression queryExpression, String collectionRole,
Boolean shallow, IDictionary`2 filters, ISessionFactoryImplementor factory)
in ..\nhsrc\Hql\Ast\ANTLR\ASTQueryTranslatorFactory.cs:27
   NHibernate.Engine.Query.HQLExpressionQueryPlan.CreateTranslators(String
expressionStr, IQueryExpression queryExpression, String collectionRole,
Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor
factory) in ..\nhsrc\Engine\Query\HQLExpressionQueryPlan.cs:34
   NHibernate.Engine.Query.HQLExpressionQueryPlan..ctor(String
expressionStr, IQueryExpression queryExpression, String collectionRole,
Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor
factory) in ..\nhsrc\Engine\Query\HQLExpressionQueryPlan.cs:23
   NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(IQueryExpression
queryExpression, Boolean shallow, IDictionary`2 enabledFilters) in
..\nhsrc\Engine\Query\QueryPlanCache.cs:88
   NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(IQueryExpression
queryExpression, Boolean shallow) in
..\nhsrc\Impl\AbstractSessionImpl.cs:302
   NHibernate.Impl.AbstractSessionImpl.CreateQuery(IQueryExpression
queryExpression) in ..\nhsrc\Impl\AbstractSessionImpl.cs:258
   NHibernate.Linq.NhQueryProvider.PrepareQuery(Expression expression,
IQuery& query, NhLinqExpression& nhQuery) in
..\nhsrc\Linq\NhQueryProvider.cs:42
   NHibernate.Linq.NhQueryProvider.Execute(Expression expression) in
..\nhsrc\Linq\NhQueryProvider.cs:22
   NHibernate.Linq.NhQueryProvider.Execute(Expression expression) in
..\nhsrc\Linq\NhQueryProvider.cs:101
   Remotion.Data.Linq.QueryableBase`1.GetEnumerator() +120

Has anyone seen this before?

James

Reply via email to