Hi,
I have some probelm with float filed with mysql.
I developed an application with Hibernate 3.1.2, Windows 2000, Mysql 5.0.18, jdk 1.5_06, mysql Connector 3.1.12 and all works.
When I deploy application on LInux (Debian 3.1, Mysql 5.0.20, jdk 1.5_06, mysql Connector 3.1.12 , Hibernate 3.1.12)
I found a problem on all float field update.
I have a table like this :
CREATE TABLE `orders_header` (
`idorders_header` int(10) unsigned NOT NULL auto_increment,
`perc_iva` float(12,2) NOT NULL,
`descr_esenzione` varchar(200) NOT NULL,
`total_price` float(10,2) NOT NULL,
`total_iva` float(10,2) NOT NULL,
`total_all` float(10,2) NOT NULL,
`note` tinytext NOT NULL,
`bank_from` varchar(200) NOT NULL,
`bank_date` datetime NOT NULL,
`elab_for_user` int(2) unsigned NOT NULL,
`elab_date` datetime NOT NULL,
`base_price` float(12,2) NOT NULL,
`idoperator` int(10) unsigned NOT NULL,
`start_job` datetime NOT NULL,
`end_job` datetime NOT NULL,
`status_job` int(2) NOT NULL,
`code_bank` varchar(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
and the float filed are mapped in Hibernate with
<property name="percIva" type="float">
<column name="perc_iva" precision="10" not-null="true" />
</property>
<property name="basePrice" type="float">
<column name="base_price" precision="10" not-null="true" />
</property>
The code to update is very simple
float price= xxx.xx;
float iva = xxx.xx;
float totalAll= xxx.xx;
float basePrice= xxx.xx;
myOrdHeader.setTotalPrice(price);
myOrdHeader.setTotalIva(iva);
myOrdHeader.setTotalAll(totalAll);
myOrdHeader.setBasePrice(basePrice);
dbFactory.update(myOrdHeader);
when I use the application in Windows this sql is generated
update dnshst.orders_header set base_price=7, descr_esenzione=' ', total_price=35.400001525879, total_iva=7.0799999237061, total_all=42.479999542236, bank_from='', note='', bank_date='1970-01-01 01:00:00', elab_date='1970-01-01 01:00:00', elab_for_user=0, idoperator=0, start_job='1970-01-01 01:00:00', end_job='1970-01-01 01:00:00', status_job=0, code_bank='' where idorders_header=97
the same application on linux create this statement
update dnshst.orders_header set base_price=7, descr_esenzione=' ',
total_price=4.2038953929745e-45, total_iva=2.6624670822172e-44,total_all=42.6624670822172e-44,
bank_from='', note='', bank_date='1970-01-01 01:00:00',
elab_date='1970-01-01 01:00:00', elab_for_user=0, idoperator=0, start_job='1970-01-01 01:00:00', end_job='1970-01-01 01:00:00', status_job=0, code_bank='' where idorders_header=97
that does not update the float fields !!!!!
Any ideas to solve this problem ? Is there a work around ?
Thanks for all
|