hibernate/hibernate-orm · error · SemanticException
Inconvertible unit " + this
Error message
Inconvertible unit " + this
What it means
Thrown by TemporalUnit.normalizationFactor(Dialect) from its switch default branch when the unit being normalized is not one of the duration-based temporal units the fall-through ladder understands (WEEK, DAY, HOUR, MINUTE, SECOND, EPOCH, NANOSECOND, NATIVE). It marks an enum constant that has no fixed nanosecond conversion — effectively an internal completeness guard reached with unsupported units.
Solutions
- Use a temporal unit with a fixed duration for conversion.
- Handle month/year units separately in application code.
Defensive patterns
Strategy: validation
When it happens
Trigger: A runtime precondition of the Hibernate API is violated.
Common situations: Occurs when application code or configuration does not satisfy the documented contract of the API being called.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/16133ebbc07e922f.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/query/common/TemporalUnit.java:259
case WEEK:
factor *= 7;
//conversion to nanos:
case DAY:
factor *= 24;
case HOUR:
factor *= 60;
case MINUTE:
factor *= 60;
case EPOCH:
case SECOND:
factor *= 1_000_000_000;
case NANOSECOND:
break;
case NATIVE:
factor *= dialect.getFractionalSecondPrecisionInNanos();
break;
default:
throw new SemanticException("Inconvertible unit " + this);
}
return factor;
}
/**
* Obtain a fragment of SQL that can be used to perform
* a unit conversion. If the normalization factor is
* very large, represent it using exponential form so
* as to minimize the noise the generated SQL.
*
* @param factor the conversion factor
* @return a string to inject into the SQL expression
*/
private static String factorAsString(long factor) {
String string = String.valueOf(factor);
int len = string.length();
int chop;
for (chop = len; chop>0 && string.charAt(chop-1)=='0'; chop--) {}View on GitHub (pinned to fad1729dce)