|
We use external Flyway to create the H2 DB. At Hibernate schema validate, an "Wrong column type" with "Found: double, expected: float" is thrown. The Member is and shall stay "Float" in Java. But H2 has no type "float" and maps the typename "float" as alias to "double". So if Hibernate validation asks h2 for the column type, "double" is returned and hybernate throws the given error.
Workaround:
-
We use "real" as type in SQL. This will change the exception to "Found: real, expected: float".
-
Than we override org.hibernate.dialect.H2Dialect with our own implementation where we call registerColumnType( Types.FLOAT, "real" ); after super(); in the constructor. So SQL-real is mapped to float and everything works for us.
Fix: change "registerColumnType( Types.FLOAT, "float" )" to "registerColumnType( Types.FLOAT, "real" )" in org.hibernate.dialect.H2Dialect
Versions: We use 4.0.1.Final, but the relevant code seems the same even in Trunk.
[1] http://h2database.com/html/datatypes.html?highlight=FLOAT4&search=float#firstFound
|