Oracle 10g doubles and Hibernate
I needed to migrate a chunk of data from an example Derby database up to Oracle 10g today. I found a minor issue with the Hibernate mappings that I was creating. In Derby I could happily have double columns, and these needed to be converted to binary_double columns in Oracle.
However I kept having issues with the schema validation in hibernate :
**Wrong column type: binary_double, expected: double precision **
After looking into the source for the dialect mappings I’ve found that creating a new dialect that extends the Oracle 9 one as follows solves this problem :
public class Oracle10Dialect extends Oracle9Dialect
{
public Oracle10Dialect()
{
super();
registerColumnType(Types.DOUBLE, "binary\_double");
}
}
Then use this class in the persistence.xml file instead of the Oracle9Dialect.