-->
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 NUMERIC with decimal number don't work
PostPosted: Thu May 04, 2006 5:06 pm 
Newbie

Joined: Mon Mar 06, 2006 12:57 pm
Posts: 3
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.1

Name and version of the database you are using:Oracle 9

Hi,
I want to map a field in NUMERIC(5,2) format from an Oracle database:
create table MYTABLE
(
COD_TYP_ENS VARCHAR2(3) not null,
COEF_TYP_ENS_REF NUMBER(5,2) not null, <-- this one
LIC_TYP_ENS VARCHAR2(10) not null,
LIB_TYP_ENS VARCHAR2(40) not null,
TEM_EN_SVE VARCHAR2(1) not null,
REM_TYP_ENS VARCHAR2(100) null ,
COD_TYP_ENS_REF VARCHAR2(2) not null,
TEM_TYP_ENS_REF VARCHAR2(1) null ,
DAT_CRE DATE not null,
UTIL_CRE VARCHAR2(30) not null,
DAT_MOD DATE null ,
UTIL_MOD VARCHAR2(30) null ,
primary key (COD_TYP_ENS)
);


I tested these hibernate mappings:
<property name="coefTypeEnsRef" column="COEF_TYP_ENS_REF" type="float"/>

and:

<property name="coefTypeEnsRef" type="float">
<column name="COEF_TYP_ENS_REF" sql-type="DECIMAL(5, 2)"></column>
</property>


In two cases, the decimal part of the number isn't saved, I got an integer(no decimal number)
According to the log, just before the update, the float value is OK.

I don't understand why it is impossible to get a float.
Thanks for your help.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 04, 2006 7:37 pm 
Expert
Expert

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 260
Did you tried type="big_decimal"


Top
 Profile  
 
 Post subject: Re: mapping oracle NUMERIC with decimal number don't work
PostPosted: Tue May 09, 2006 6:43 am 
Newbie

Joined: Tue May 09, 2006 6:29 am
Posts: 1
francai wrote:
In two cases, the decimal part of the number isn't saved, I got an integer(no decimal number)
According to the log, just before the update, the float value is OK.


Hi,
i got exactly the same problem, using Hibernate 3.0 and Oracle 9.i
when trying to map Oracle's NUMBER(%s,%p) with a Java Float object, i cannot UPDATE the field with its decimal part

when enterring a decimal value directly, it works fine
then, i can get the decimal part in the Float object, so no problem getting the value but updating results in the entire part only...

it only occurs with Float objects
BigDecimal and Double objects work fine..

did you find the solution to your problem ?
does anyone know how to map a decimal number with a java Float object ??

thanx in advance !!


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.