Skip to content

Commit 4cedcfe

Browse files
committed
HHH-19926 NullPointerException when executing JPQL IN clause with null parameter on entity association
1 parent 0be1d31 commit 4cedcfe

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

hibernate-core/src/main/java/org/hibernate/query/spi/AbstractCommonQueryContract.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -803,16 +803,17 @@ public CommonQueryContract setParameter(String name, Object value) {
803803
return this;
804804
}
805805

806-
private boolean multipleBinding(QueryParameter<Object> param, Object value){
807-
if ( param.allowsMultiValuedBinding() ) {
808-
final Type<?> hibernateType = param.getHibernateType();
809-
if ( hibernateType == null
806+
private boolean multipleBinding(QueryParameter<Object> parameter, Object value){
807+
if ( parameter.allowsMultiValuedBinding() ) {
808+
final var hibernateType = parameter.getHibernateType();
809+
return hibernateType == null
810+
|| value == null
810811
|| hibernateType instanceof NullSqmExpressible
811-
|| isInstance( hibernateType, value ) ) {
812-
return true;
813-
}
812+
|| isInstance( hibernateType, value );
813+
}
814+
else {
815+
return false;
814816
}
815-
return false;
816817
}
817818

818819
private <T> void setTypedParameter(String name, TypedParameterValue<T> typedValue) {

0 commit comments

Comments
 (0)