-->
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: SQLServerDialect Double Float schema export
PostPosted: Tue Feb 27, 2007 11:19 pm 
Newbie

Joined: Sun Jan 22, 2006 11:46 pm
Posts: 8
3.2.2:

Using SQLServer 2000

Hey Ho,

Am trying to use the updateSchema tool to.... update my schema.

Taking the following definition
Code:
<property name="OpenPrice" precision="15" scale="6"/>


Update schema runs fine but creates the column with a datatype of float. Being as floats are approximate numbers only and should be used as the storage type of last resort (especially with financial systems), I was hoping to see it be stored as numeric(15,6).

Seems the only way to do this is to define the entry as:

Code:
<property name="OpenPrice">
            <column name="OpenPrice" sql-type="numeric(15,6)"/>
</property>


The overhead comes here in having to create the column name mapping twice along with the nested <column...> entry (picky aint I?)

Twas my vague hope, that having a pojo with a Double type and specifying precsion and scale would create the table structure using a more precise storage value that a float.

Am I barking up the wrong tree with the way I'm going about this?

tia


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 28, 2007 9:59 am 
Beginner
Beginner

Joined: Mon Jan 22, 2007 1:16 pm
Posts: 21
How about using the hibernate type 'big_decimal'?

<property name="OpenPrice" type="big_decimal" precision="15" scale="6">

I think this would work even if your POJO is using Double and not java.math.BigDecimal.

-Mark


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 28, 2007 9:23 pm 
Newbie

Joined: Sun Jan 22, 2006 11:46 pm
Posts: 8
Cheers Mark, worked a treat.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 01, 2007 7:14 pm 
Newbie

Joined: Sun Jan 22, 2006 11:46 pm
Posts: 8
Hmm, have to take that back. It worked great for creating/altering the schema, but when reading it back, HIB expected the datatype to be a bigDecimal. Just took me a while to notice....

Will keep on it...


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.