hibernate/hibernate-orm · error · IllegalArgumentException

Unrecognized constraint type '{}'

Error message

Unrecognized constraint type '{}'

What it means

Error "Unrecognized constraint type '{}'" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/restriction/JakartaDataRestriction.java:345

					stringExpression( like.pattern(), root, builder ),
					like.escape()
			);
		}
		else if ( constraint instanceof NotLike notLike ) {
			return builder.notLike(
					stringExpression( expression ),
					stringExpression( notLike.pattern(), root, builder ),
					notLike.escape()
			);
		}
		else if ( constraint instanceof Null<?> ) {
			return builder.isNull( expression );
		}
		else if ( constraint instanceof NotNull<?> ) {
			return builder.isNotNull( expression );
		}
		else {
			throw new IllegalArgumentException(
					"Unrecognized constraint type '" + constraint.getClass().getName() + "'" );
		}
	}

	private static Predicate in(
			Expression<?> expression,
			List<? extends jakarta.data.expression.Expression<?, ?>> expressions,
			Root<?> root,
			CriteriaBuilder builder) {
		final ArrayList<Expression<?>> values = new ArrayList<>( expressions.size() );
		for ( var value : expressions ) {
			if ( value instanceof Literal<?> literal ) {
				verifyValueType( expression, literal.value() );
				values.add( literal( literal.value(), expression, builder ) );
			}
			else {
				final var valueExpression = expression( value, root, builder );
				verifyAssignableExpressionType( expression, valueExpression );

View on GitHub (pinned to fad1729dce)

Solutions

  1. The constraint type is not recognized. Use a supported constraint (equal-to, like, between, ...) for the restriction.

When it happens

Trigger: A Jakarta Data restriction is invalid or unsupported: Unrecognized constraint type '<value>'

Common situations: Building Restrictions with empty paths, unsupported restriction/constraint/expression types, or expressions of the wrong Java type.


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