-->
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.  [ 3 posts ] 
Author Message
 Post subject: Mapping Oracle Number(5,2)
PostPosted: Wed Aug 29, 2007 5:30 pm 
Newbie

Joined: Tue Aug 28, 2007 2:09 pm
Posts: 9
Hi,

I am using Oracle 9i. I have a column of type Number(5,2) , how shall i map it in Hibernate? What should be the data type in POJO class and what shall be the property type in hbm.xml file? I tried with Float but it is not working.

Thanks


Top
 Profile  
 
 Post subject: Mapping of number
PostPosted: Thu Aug 30, 2007 1:25 am 
Beginner
Beginner

Joined: Mon Nov 22, 2004 11:21 am
Posts: 42
Hi,
unless it is a scientific application, you should use "big_decimal". This maps to the Java-Class BigDecimal. In business software you should always prefer fix point arithmetic over floating point arithmetic.


Regards,
Georg

_________________
Real programmers confuse Halloween and Christmas because OCT 31 = DEC 25


Top
 Profile  
 
 Post subject: Re: Mapping Oracle Number(5,2)
PostPosted: Thu Aug 30, 2007 9:20 am 
Newbie

Joined: Fri Aug 17, 2007 2:24 pm
Posts: 6
c_java wrote:
Hi,

I am using Oracle 9i. I have a column of type Number(5,2) , how shall i map it in Hibernate? What should be the data type in POJO class and what shall be the property type in hbm.xml file? I tried with Float but it is not working.

Thanks


1. The data type in POJO class should be "private Double amount;"
2. The property type in hbm.xml file shall be

<property
name="amount"
type="java.lang.Double"
>
<column name="AMOUNT" sql-type="NUMBER(5,2)" />
</property>

Good Luck!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.