Hello,
I have a float rounding problem with Hibernate which only appears with MySQL.
The problem is: when an object contains a float data type, values inserted in mysql are rounded to their closest integers.
For instance:
<class name="com.kertel.kercash.serialization.TarifUsingAppel" table="tarif">
....
<property name="amount" type="float" column="tari_montant" />
...
</class>
corresponding to this class:
public class TarifUsingAppel extends Tarif {
...
}
and
public class Tarif {
private float amount;
....
}
Saving such a class, into the table:
CREATE TABLE tarif (
tari_id int(11) NOT NULL default '0',
tari_montant float NOT NULL default '0',
PRIMARY KEY (tari_id)
) TYPE=MyISAM;
always transforms my floats into integers.
Browsing the net i found this on the mysql jdbc driver:
http://www.mysql.com/documentation/conn ... #id2802892
I use:
mysql version: MySQL 3.23.49-max-n
hibernate 2.0.2
jdbc drver: mysql-connector-java-2.0.14-bin.jar
Thank you for your ideas,
Adrian.