Skip to content

NHibernate 5 precision maximum on decimal reduced vs. NHibernate 4 #1606

Closed
@TiltonJH

Description

@TiltonJH

Hi,

I am facing an issue with the precision on an System.Decimal property.

I map a properties of System.Decmial (using FluentNHibernate) to decimal(38,5) in NHibernate 4.x, which works well.
Now I do the same thing with NHibernate 5.0.3, but I only get a maximum of decimal(28,5).

(I use the ExportSchema to generate to data base an SQL Server 2016.)

Now trying to store a valid System.Decimal of the value 792281625142643375935439.50335m (== decimal.MaxValue / 10000m) within the data base and I get an SqlException: Arithmetic overflow error converting numeric to data type numeric. The statement has been terminated.

So in this test one has a valid System.Decimal with 29 significant digits and it would work with decimal(29,5), but I can not set that precision either.

29 to 38 significant digits have the same space requirements within the data base (17 bytes, decimal and numeric (Transact-SQL)) so I use the maximum of 38.

I think it changed in "NH-4088 - Dialect.GetCastTypeName is buggy (#709)".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions