-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Saving 9 decimal places in the DB
PostPosted: Wed Feb 13, 2008 12:43 pm 
Newbie

Joined: Mon Oct 15, 2007 6:07 pm
Posts: 4
Hi,

I am trying to get NHibernate to save a System.Decimal into the database with 9 decimal places. However it is only saving 5 DPs.
The SQL type on the DB is numeric(18,9) so when I view the table I see 9 DPs but the last 4 are always 0.

I've tried setting the sql-type to
numeric
decimal
numeric(18,9)
decimal(18,9)

as well as setting the length property to various numbers.

Is this a known issue or is there something I've miseed? I'm using NHibernate 1.0.3.

Thanks in advance,
Phil


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 13, 2008 4:45 pm 
Regular
Regular

Joined: Wed Aug 15, 2007 7:37 am
Posts: 73
You don't say what DB you're using, but a lot of the Dialects register Decimal types as:
RegisterColumnType(DbType.Decimal, "DECIMAL(19,5)");

I don't know enough to know whether that overrides what you're specifying in the sql-type, but a dig around in the source might help if you're that way inclined.

Steve


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 18, 2008 6:23 am 
Newbie

Joined: Mon Oct 15, 2007 6:07 pm
Posts: 4
Thanks for the reply.

I have found a workaround by having a public decimal property linked to a protected string property which is data-mapped.
The mapping file (hbm) is setup to map from a .Net string to a SQL Server varchar but in fact the DB column remains a decimal(18.9).

Cheers,
Phil


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 18, 2008 11:15 am 
Newbie

Joined: Tue Jun 12, 2007 1:25 pm
Posts: 11
Location: Brazil
philr wrote:
Thanks for the reply.

I have found a workaround by having a public decimal property linked to a protected string property which is data-mapped.
The mapping file (hbm) is setup to map from a .Net string to a SQL Server varchar but in fact the DB column remains a decimal(18.9).

Cheers,
Phil


Hi all,

When I read this post, I verified my application and the samething happens, this will create many troubles for me, if somebody knows the solution post a reply, please!!!!!!!!!!!!!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.