hibernate/hibernate-orm · error · SemanticException
Illegal unit " + this
Error message
Illegal unit " + this
What it means
Error "Illegal unit " + this" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/common/TemporalUnit.java:349
* durations.
*/
public TemporalUnit normalized() {
switch (this) {
case NANOSECOND:
case NATIVE:
case HOUR:
case MINUTE:
case SECOND:
case EPOCH:
case DAY:
case WEEK:
return NANOSECOND;
case YEAR:
case QUARTER:
case MONTH:
return MONTH;
default:
throw new SemanticException("Illegal unit " + this);
}
}
@Override
public String toString() {
return super.toString().toLowerCase();
}
}
View on GitHub (pinned to fad1729dce)
Solutions
- Use a supported TemporalUnit in this context.
- Check the unit against the database dialect's supported units.
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/8fa41a266c654134.
Report an issue: GitHub.