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.