Click here to Skip to main content
15,887,304 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello,

I have the following piece of code
var result = session.Query<Employee>()
                    .GroupBy(x => x.Name)
                    .Select(s => new
                               {
                                sal = s.Sum(x =>x.Salary)
                               }
                           );


In My employee map i have my salary set to decimal(25,4).while querying the above, NH is generating the following

cast(sum(employee.Salary) as DECIMAL(19,5)) as col


As I have not given any particular map to the result , nhibernate is casting my result.sal to decimal(19,5) by default.However my data is containing more than 19 digits and this is resulting in an arithmetic overflow exception. Is there a way to avoid this,like asking NH to consider casting my result as (25,4) instead?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900