9

I use nhibernate 3 with fluent mapping and MySQL5Dialect. I do grouping and trying to get average value:

var group = new TotalStatistic();
        SelectList(s => s
            .SelectGroup(t => t.RegistryName).WithAlias(() => group.Name)
            .SelectAvg(t => t.Value).WithAlias(() => group.Average))
            .TransformUsing(Transformers.AliasToBean<TotalStatistic>());

But it generates sql query that contains cast to decimal and I get only zeroes in results instead of something like "0.0035" I suppose to get.

SELECT ... avg(cast(this_.Value as DECIMAL)) as y1_ ...
David Ansermot
  • 6,052
  • 8
  • 47
  • 82
pavel
  • 141
  • 6
  • what datatype does the Value column have? – Firo Aug 23 '12 at 13:56
  • I believe I tried float, decimal and double with the same result – pavel Aug 28 '12 at 11:51
  • 1
    I'm willing to bet this is the same issue as [NH-2429] which was fixed in 3.3.0. I've added a bounty in case there is another cause or a workaround – JP. Dec 18 '12 at 03:37

0 Answers0