in google-cloud-spanner-hibernate-dialect/src/main/java/com/google/cloud/spanner/hibernate/SpannerDialect.java [198:216]
protected String columnType(int sqlTypeCode) {
if (sqlTypeCode == DECIMAL || sqlTypeCode == NUMERIC) {
return "numeric";
}
if (sqlTypeCode == JSON) {
return "json";
}
// The JDBC spec is a bit confusing here.
// DOUBLE == FLOAT == 64 bit
// REAL == 32 bit
// The default Hibernate implementation did not really get this right, as it uses
// java.sql.Types.FLOAT for java.lang.Float. It should have been java.sql.Types.REAL.
// This dialect follows the default Hibernate implementation, and in order to actually
// use a float32, you need to annotate the column with the JDBC type code REAL.
if (sqlTypeCode == REAL) {
return "float32";
}
return super.columnType(sqlTypeCode);
}