Hibernate version:
Hibernate Core 3.3.1.GA
Name and version of the database you are using:
Apache Derby 10.4.2.0
Hello,
I'm using Hibernate to create a table from the hbm.xml mapping.
The hibernate mapping is as follows:
Code:
<hibernate-mapping package="com.examples">
<class name="MyClass" table="MY_TABLE">
<id name="id" column="MY_ID" type="long">
<generator class="increment"/>
</id>
<property name="offset" column="OFFSET" type="float"/>
</class>
</hibernate-mapping>
When Hibernate create the table, the DDL says:
Code:
create table MY_TABLE (MY_ID bigint not null, OFFSET float, primary key (MY_ID))
But at the end, the offset column is type DOUBLE.
The Derby documentation (
http://db.apache.org/derby/docs/10.1/re ... 27281.html) explains this:
If you use float, the default precision is 53 so you will end with double (double precision).
To get a single precision float you must specify a precision of 23 or less.
The Derby dialect maps the "float" java type to the "float" derby type. That's wrong because the implicit precision is 53 and that will produce a double.
The Derby dialect should map the "float" java type to the "float(23)" derby type.
I have also used the "precision" attribute in the column mapping, like this:
Code:
<property name="offset" column="OFFSET" type="float" precision="23"/>
But that has no effect.
What do you think?