hibernate/hibernate-orm · error · IllegalArgumentException
Path may not be empty
Error message
Path may not be empty
What it means
Error "Path may not be empty" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/Order.java:375
private jakarta.persistence.criteria.Order order(
Expression<?> expression,
CriteriaBuilder builder) {
return direction() == DESCENDING
? builder.desc( expression, nullPrecedence() )
: builder.asc( expression, nullPrecedence() );
}
private Expression<?> expression(Root<?> root, CriteriaBuilder builder) {
final var path = path( root, attributeName() );
return caseSensitive() ? path : builder.lower( path.as( String.class ) );
}
private static Path<?> path(Root<?> root, String path) {
requireNonNull( path, "missing path" );
final var tokens = new StringTokenizer( path, "." );
if ( !tokens.hasMoreTokens() ) {
throw new IllegalArgumentException( "Path may not be empty" );
}
Path<?> criteriaPath = root;
while ( tokens.hasMoreTokens() ) {
criteriaPath = criteriaPath.get( tokens.nextToken() );
}
return criteriaPath;
}
/**
* Reverse the direction of the given ordering list
*
* @param ordering a list of {@code Order} items
* @return a new list, with each {@code Order} reversed
*
* @see #reverse()
*
* @since 6.5
*/View on GitHub (pinned to fad1729dce)
Solutions
- Provide a non-empty attribute path for the Order.
- Use Order.asc/desc with a valid property name.
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/309a6d7a9c316212.
Report an issue: GitHub.