-->
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: jpa-ql and strictfp equivalent
PostPosted: Tue Oct 03, 2006 11:47 am 
Regular
Regular

Joined: Fri Jul 30, 2004 4:02 pm
Posts: 50
ver: ejb3-RC9

Hi all,
I'm doing simple addition and subtraction formulas in my JPA-QL's/EJB-QL's in the where clause of queries.

Example: select node from Balances node where (node.totalPrice - node.tax - node.retailPrice != 0)

All the properties are created from Hibernate/EJB3 from the BigDecimal java class, and on the database side it looks like it is creating the appropriate fields (i.e. 19,2 decimal fields by default).

My problem comes from inconsistent results from the same JPA QL. When trying to run the above query on Hypersonic, it works correctly/as-expected. When running on Mysql 4.1, run into floating-point equivelant miscalculations (i.e. different results than on Hypersonic).

Is there any way to alleviate this, or should I resort to evaluating all of the nodes as java objects for these calculations instead of database-side?

thanks,
-D


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 04, 2006 12:12 pm 
Regular
Regular

Joined: Fri Jul 30, 2004 4:02 pm
Posts: 50
Somewhat resolved - Mysql doesn't handle decimal precision calculations until => 5.0.3

However, this makes me feel like you do build your application to a specific database to make sure these types of query-level mathematical calculations are done correctly.

Any comments on this?

thanks,
-D


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 09, 2006 4:48 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Well at some point you database is supposed to deal with ANSI SQL in a correct fashion

_________________
Emmanuel


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.