@@ -5181,13 +5181,21 @@ else if ( paramType instanceof EntityDomainType ) {
5181
5181
5182
5182
if ( paramSqmType instanceof SqmPathSource <?> || paramSqmType instanceof BasicDomainType <?> ) {
5183
5183
// Try to infer the value mapping since the other side apparently is a path source
5184
- final MappingModelExpressible <?> inferredValueMapping = getInferredValueMapping ();
5185
- if ( inferredValueMapping != null ) {
5186
- return resolveInferredValueMappingForParameter ( inferredValueMapping );
5184
+ final MappingModelExpressible <?> inferredMapping = resolveInferredType ();
5185
+ if ( inferredMapping != null ) {
5186
+ if ( inferredMapping instanceof PluralAttributeMapping ) {
5187
+ return resolveInferredValueMappingForParameter ( ( (PluralAttributeMapping ) inferredMapping ).getElementDescriptor () );
5188
+ }
5189
+ else if ( !( inferredMapping instanceof JavaObjectType ) ) {
5190
+ // Do not report back the "object type" as inferred type and instead try to rely on the paramSqmType.getExpressibleJavaType()
5191
+ return resolveInferredValueMappingForParameter ( inferredMapping );
5192
+ }
5187
5193
}
5188
5194
5195
+ final Class <?> parameterJavaType = paramSqmType .getExpressibleJavaType ().getJavaTypeClass ();
5196
+
5189
5197
final BasicType <?> basicTypeForJavaType = getTypeConfiguration ().getBasicTypeForJavaType (
5190
- paramSqmType . getExpressibleJavaType (). getJavaTypeClass ()
5198
+ parameterJavaType
5191
5199
);
5192
5200
5193
5201
if ( basicTypeForJavaType == null ) {
@@ -5200,11 +5208,15 @@ else if ( paramSqmType instanceof SingularAttribute ) {
5200
5208
return resolveEntityPersister ( (EntityDomainType <?>) type );
5201
5209
}
5202
5210
}
5211
+ else if ( parameterJavaType .isEnum () ) {
5212
+ //inferredMapping is JavaObjectType and we cannot deduct the t
5213
+ if ( inferredMapping != null ) {
5214
+ return inferredMapping ;
5215
+ }
5216
+ }
5203
5217
}
5204
-
5205
5218
return basicTypeForJavaType ;
5206
5219
}
5207
-
5208
5220
throw new ConversionException ( "Could not determine ValueMapping for SqmParameter: " + sqmParameter );
5209
5221
}
5210
5222
@@ -6681,7 +6693,7 @@ public LikePredicate visitLikePredicate(SqmLikePredicate predicate) {
6681
6693
@ Override
6682
6694
public NullnessPredicate visitIsNullPredicate (SqmNullnessPredicate predicate ) {
6683
6695
return new NullnessPredicate (
6684
- (Expression ) predicate .getExpression (). accept ( this ),
6696
+ (Expression ) visitWithInferredType ( predicate .getExpression (), () -> basicType ( Object . class ) ),
6685
6697
predicate .isNegated (),
6686
6698
getBooleanType ()
6687
6699
);
0 commit comments