Vani
unread,Jan 23, 2008, 3:03:51 AM1/23/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to NHibernate-Hispano, sriva...@gmail.com
When inserting data into a SQL Server database from my application
that is utilizing NHibernate ver. 1.0, the format for my decimal
datatype values is being forced to decimal(19,5), regardless of the
precision defined for the attribute in the SQL Server table. This
results in decmial values being truncated before being written to the
SQL Server database. An example of the stored procedure call that is
generated by the NHibernate environment when my application calls the
Session.Save() method is as follows:
exec sp_executesql N'INSERT INTO TEST_TABLE(DECIMAL_VALUE1,
DECIMAL_VALUE2, LONG_VALUE1) VALUES (@p0, @p1, @p2); select
SCOPE_IDENTITY()', N'@p0 decimal(19,5),@p1 decimal(19,5),@p2 bigint',
@p0 = 9.94434, @p1 = 9.94434, @p2 = 5583
It is not obvious to me what is causing the "decimal(19,5)"
specification to be included for my decimal datatype values in the
stored procedure query generated from NHibernate. Within the SQL
Server table, the attributes that represent DECIMAL_VALUE1 and
DECIMAL_VALUE2 originally were defined to be decimal(16,6), but are
now defined as decimal(18,12). However, the stored procedure still
specifies these values as datatype decimal(19,5) as shown above.
I checked my nhibernate.config and mapping files and didn't see a
specification for this parameter or a decimal datatype precision
value, so I'm not sure if/where this is being defined.
Any help to clarify this behavior or to look into this possible bug
would be appreciated.
Thank you,
Vani