-->
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: default value for not map-able values?? (Double-Infinity)
PostPosted: Thu Jul 10, 2008 9:20 am 
Newbie

Joined: Thu Jul 10, 2008 8:20 am
Posts: 2
Hi,

Hibernate Version: 3.2.6.ga

I have a class with few Double-values to write in the Database. With HSQLDB it works fine.

I switched now to MySQL, and I get following Error Message:
Quote:
14:10:04,184 INFO DoubleType:144 - could not bind value 'Infinity' to parameter: 13; 'Infinity' is not a valid numeric or approximate numeric value


The reason for this error is clear, the Double value is set to Infinity and hibernate is not able to map Infinity to a mysql-double.

Now my question, is there maybe a way to set a default value for not map-able values?

For example:
every times the translator receives a 'Infinity' -> map it to '100.000'.

Thx in advance


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 10, 2008 11:01 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Quote:
"MySQL Server can't yet handle NaN, -Inf, and Inf values in double. Using these will cause problems when trying to export and import data. We should as an intermediate solution change NaN to NULL (if possible) and -Inf and Inf to the minimum respective maximum possible double value. "


Looks like there's a setting on the MySQL/ConnectorJ datasource properties file that allows you to configure NAN settings:

Quote:
allowNanAndInf Should the driver allow NaN or +/- INF values in PreparedStatement.setDouble()? No false

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 10, 2008 11:10 am 
Newbie

Joined: Thu Jul 10, 2008 8:20 am
Posts: 2
Thanks for your help

Sorry that I posted in this forum but I was convinced that this must be a hibernate error. I didn't thought about the possiblity that MySQL is the malefactor ...

Thx again


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.