hibernate/hibernate-orm · error · IllegalArgumentException

Unknown sort order: " + value

Error message

Unknown sort order: " + value

What it means

Error "Unknown sort order: " + value" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/SortDirection.java:35

	ASCENDING,
	DESCENDING;

	public SortDirection reverse() {
		return switch (this) {
			case ASCENDING -> DESCENDING;
			case DESCENDING -> ASCENDING;
		};
	}

	public static SortDirection interpret(String value) {
		if ( value == null ) {
			return null;
		}
		else {
			return switch ( value.toLowerCase(Locale.ROOT) ) {
				case "asc", "ascending" -> ASCENDING;
				case "desc", "descending" -> DESCENDING;
				default -> throw new IllegalArgumentException( "Unknown sort order: " + value );
			};
		}
	}
}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Use 'asc' or 'desc' (case-insensitive) as the sort order string.
  2. Map external sort strings to SortDirection explicitly.

When it happens

Trigger: A name referenced in a mapping, query, or configuration cannot be resolved at runtime.

Common situations: Typos in entity/attribute/mapping names, missing mappings, or refactoring without updating references.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/743e5e3f9eb6c540. Report an issue: GitHub.