I'm trying to create a database table automatically using Hibernate and I have a few columns that are of type double (in Java). These columns have different precisions associated with them. For example, you might want to see the speed of a vehicle like "56.23" km/h. However, right now I'm getting something like "56.232343536918" km/h.
I'm using the <property name="hibernate.hbm2ddl.auto">update</property>
property in my hibernate.cfg.xml
file in order to automatically create the table using the associated mapping file.
Here's how I declared one the columns:
<property name="accelerometer_y" type="java.lang.Double">
<column name="ACCELEROMETER_Y" precision="4" scale="2"/>
</property>
So from what I read about this in Hibernate, this is the proper way of declaring a MySQL data type of DOUBLE(4,2). However, when Hibernate automatically generates the table, I get DOUBLE, not DOUBLE(4,2). I don't get the precision and scale numbers that I've specified.
Does anybody see what's wrong in here?