hibernate/hibernate-orm · error · IllegalArgumentException
scale has no meaning for SQL floating point types
Error message
scale has no meaning for SQL floating point types
What it means
Column-size normalization rejected a mapping that specifies scale for a floating-point SQL type (FLOAT/DOUBLE/REAL): these types have only precision, so a scale value is meaningless. Remove the scale (or the precision/scale pair) from the @Column/size for such attributes.
Solutions
- Remove the scale attribute from the column mapping.
- Use a decimal/numeric type if scale is required.
Defensive patterns
Strategy: validation
When it happens
Trigger: Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: scale has no meaning for SQL floating point types.
Common situations: Common when running against a database whose dialect lacks this capability, when a mapping or HQL/Criteria query requests unsupported functionality, or when the wrong dialect is configured for the database in use. Error: scale has no meaning for SQL floating point types.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/b3ddb4bccd07e4b7.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java:6035
case SqlTypes.BINARY:
case SqlTypes.VARBINARY:
case SqlTypes.CLOB:
case SqlTypes.BLOB:
size.setLength( javaType.getDefaultSqlLength( Dialect.this, jdbcType ) );
break;
case SqlTypes.LONGVARCHAR:
case SqlTypes.LONGNVARCHAR:
case SqlTypes.LONGVARBINARY:
size.setLength( javaType.getLongSqlLength() );
break;
case SqlTypes.FLOAT:
case SqlTypes.DOUBLE:
case SqlTypes.REAL:
// this is almost always the thing we use:
length = null;
size.setPrecision( javaType.getDefaultSqlPrecision( Dialect.this, jdbcType ) );
if ( scale != null && scale != 0 ) {
throw new IllegalArgumentException("scale has no meaning for SQL floating point types");
}
// but if the user explicitly specifies the precision, we need to convert it:
if ( precision != null ) {
// convert from base 10 (as specified in @Column) to base 2 (as specified by SQL)
// using the magic of high school math: log_2(10^n) = n*log_2(10) = n*ln(10)/ln(2)
precision = (int) ceil( precision * LOG_BASE2OF10 );
}
break;
case SqlTypes.TIME:
case SqlTypes.TIME_WITH_TIMEZONE:
case SqlTypes.TIME_UTC:
case SqlTypes.TIMESTAMP:
case SqlTypes.TIMESTAMP_WITH_TIMEZONE:
case SqlTypes.TIMESTAMP_UTC:
length = null;
size.setPrecision( javaType.getDefaultSqlPrecision( Dialect.this, jdbcType ) );
if ( scale != null && scale != 0 ) {
throw new IllegalArgumentException("scale has no meaning for SQL time or timestamp types");View on GitHub (pinned to fad1729dce)