[OFBiz] Dev - Use of BigDecimal for Database Values

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[OFBiz] Dev - Use of BigDecimal for Database Values

David E. Jones

Here is some brief information on use of BigDecimal values through  
the Entity Engine going to/from the database. This related to changes  
committed in SVN revision 5993, which has changes needed in the  
Entity Engine to support BigDecimal.

====================================

The only proper solution for this, where the information is coming  
from the database, is to use getBigDecimal and setBigDecimal on the  
ResultSet and PreparedStatement. In most cases using the String  
constructor is the way to go if you have a String, but coming from  
the database you don't really...

So, there is now a getBigDecimal that will be a native BigDecimal if  
the fieldtypes*.xml file has that for the java-type, but if it  
doesn't it will convert from a Double (for now).

I played around with changing the java-type to BigDecimal for the 2  
currency data types and found that there will be a lot of problems  
with this... Including things like attribute types in service  
definitions, type casting in Java methods, and so on. So, going in  
this direction (where we really need to go) is going to be a lot of  
work...

-David


 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev

smime.p7s (3K) Download Attachment