{"record":{"id":"ed3669f67b8fc46d","repo":"hibernate/hibernate-orm","slug":"expected-value-but-got","errorCode":null,"errorMessage":"Expected '{}' value but got '{}'","messagePattern":"Expected '(.+?)' value but got '(.+?)'","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/restriction/JakartaDataRestriction.java","lineNumber":653,"sourceCode":"\t\t\t}\n\t\t}\n\t}\n\n\tprivate static void verifyAssignableExpressionType(\n\t\t\tExpression<?> expression,\n\t\t\tExpression<?> valueExpression) {\n\t\tfinal var expressionType = wrapperType( expression.getJavaType() );\n\t\tfinal var valueType = wrapperType( valueExpression.getJavaType() );\n\t\tif ( expressionType != null && valueType != null && !expressionType.isAssignableFrom( valueType ) ) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"Expected '\" + expressionType.getName() + \"' expression but got '\" + valueType.getName() + \"'\" );\n\t\t}\n\t}\n\n\tprivate static void verifyValueType(Expression<?> expression, Object value) {\n\t\tfinal var expressionType = wrapperType( expression.getJavaType() );\n\t\tif ( value != null && expressionType != null && !expressionType.isInstance( value ) ) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"Expected '\" + expressionType.getName() + \"' value but got '\" + value.getClass().getName() + \"'\" );\n\t\t}\n\t}\n\n\tprivate static Class<?> wrapperType(Class<?> javaType) {\n\t\tif ( javaType == null || !javaType.isPrimitive() ) {\n\t\t\treturn javaType;\n\t\t}\n\t\telse if ( javaType == boolean.class ) {\n\t\t\treturn Boolean.class;\n\t\t}\n\t\telse if ( javaType == byte.class ) {\n\t\t\treturn Byte.class;\n\t\t}\n\t\telse if ( javaType == char.class ) {\n\t\t\treturn Character.class;\n\t\t}\n\t\telse if ( javaType == double.class ) {","sourceCodeStart":635,"sourceCodeEnd":671,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/restriction/JakartaDataRestriction.java#L635-L671","documentation":"Error \"Expected '{}' value but got '{}'\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A runtime precondition of the Hibernate query API is violated: Expected '<value>' value but got '<value>'","commonSituations":"Application code or configuration calls the query API in a way that violates its documented contract; the interpolated values in the message identify the offending input.","solutions":["The value has an unexpected type. Supply a value of the expected type for the restriction."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}