When mapping a SQL table to a model using Hibernate or NHibernate, if you configure the mapping like following
<property name=”MyDecCol” type=”Decimal” precision=”28″ scale=”15″>
<column name=”MyDecCol” sql-type=”decimal” not-null=”false” />
</property>
For some reason, Hibernate/NHibernate will treat the field as a decimal with scale = 5 (5 decimal digits on the right side of the decimal separator). So if you save a value to this column with more decimal digits, it will be truncated to only 5 decimal digits.
I’m not sure why, but if you move the attributes to the inner column element, Hibernate and NHibernate will map the values correctly.
<property name=”MyDecCol” type=”Decimal”>
<column name=”MyDecCol” sql-type=”decimal” not-null=”false” precision=”28″ scale=”15″ />
</property>