-->
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.  [ 10 posts ] 
Author Message
 Post subject: Error in Float with hibernate 3.1.2
PostPosted: Mon Jun 05, 2006 4:43 am 
Newbie

Joined: Fri Jan 07, 2005 3:57 am
Posts: 16
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.1.2

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

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

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Hi all,

I´m using hibernate 3.1.2 with springframework 1.2, and when I save a Float in the database, hibernate truncates the decimal part, only stores the integer part.

I have look for this error, and it was a bug in the past what it was fixed, but I have this problem.

What I can do?

Thanks in advance,

Rodolfo


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 05, 2006 5:22 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
it is most likely a jboss driver problem. Use a better more uptodate driver.

_________________
Max
Don't forget to rate


Last edited by max on Mon Jun 05, 2006 5:54 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 05, 2006 5:49 am 
Expert
Expert

Joined: Thu Sep 22, 2005 10:29 am
Posts: 285
Location: Almassera/Valencia/Spain/EU/Earth/Solar system/Milky Way/Local Group/Virgo Supercluster
Do you have a length property in the <property> tag of the mapping file?
I think that instead you have to use a precision scale combination that reflects your column definition.
for example:
Code:
<property name="balance" precision="12" scale="2"/>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 05, 2006 6:22 am 
Beginner
Beginner

Joined: Wed May 17, 2006 3:38 am
Posts: 45
pepelnm wrote:
Do you have a length property in the <property> tag of the mapping file?
I think that instead you have to use a precision scale combination that reflects your column definition.
for example:
Code:
<property name="balance" precision="12" scale="2"/>


I feel what max said is correct - since it is not possible for the default behaviour to truncate a flloat to integer - that will be awful - precision and scale is for only those cases where a desired precision/scale is required insstead of the default

_________________
===============================
Rate, if it helped


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 05, 2006 6:41 am 
Expert
Expert

Joined: Thu Sep 22, 2005 10:29 am
Posts: 285
Location: Almassera/Valencia/Spain/EU/Earth/Solar system/Milky Way/Local Group/Virgo Supercluster
Ok, ok, it's my fault.

In fact, it looks that the only use for length, precision and scale is Automatic schema generation.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 05, 2006 7:14 am 
Newbie

Joined: Fri Jan 07, 2005 3:57 am
Posts: 16
max wrote:
it is most likely a jboss driver problem. Use a better more uptodate driver.


I don't use any JBoss driver, I use tomcat 4.1.31. In my lib path I haven´t any *.jar from JBoss, I think...

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 05, 2006 7:48 am 
Expert
Expert

Joined: Thu Sep 22, 2005 10:29 am
Posts: 285
Location: Almassera/Valencia/Spain/EU/Earth/Solar system/Milky Way/Local Group/Virgo Supercluster
JDBC driver


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 05, 2006 8:00 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
lol, i can't write today.

It is possibly an *oracle* driver problem.

/max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 05, 2006 8:03 am 
Beginner
Beginner

Joined: Wed May 17, 2006 3:38 am
Posts: 45
Are you using classes111.jar or classes12.jar [these are oracle jdbc driver files]-- you may play with interchanging them to see the effect

Rodolfo wrote:
max wrote:
it is most likely a jboss driver problem. Use a better more uptodate driver.


I don't use any JBoss driver, I use tomcat 4.1.31. In my lib path I haven´t any *.jar from JBoss, I think...

Thanks

_________________
===============================
Rate, if it helped


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 29, 2006 7:16 am 
Newbie

Joined: Fri Jan 07, 2005 3:57 am
Posts: 16
the problem is the driver with "float" data type, i have changed to "double" and works perfectly.

Thanks

Rodolfo


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