hibernate/hibernate-orm · error · IllegalArgumentException
Path may not be empty
Error message
Path may not be empty
What it means
Path-parsing guard in Order's private path helper: after tokenizing the attribute path, no tokens remain (the path string was empty or only separators), so no criteria Path can be resolved for ordering. The faulty input is the attributeName/path string used to build the Order; supply a non-empty attribute path.
Solutions
- Provide a non-empty attribute path for the Order.
- Use Order.asc/desc with a valid property name.
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/309a6d7a9c316212.
Report an issue: GitHub.
Appendix: 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)