Skip to content

Commit df48ee9

Browse files
committed
HHH-19698 Fix parsing of in list predicate with null literal
1 parent 1242edc commit df48ee9

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

hibernate-core/src/main/java/org/hibernate/type/descriptor/java/JavaTypeHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ public static boolean isTemporal(JavaType<?> javaType) {
3434
}
3535

3636
public static boolean isUnknown(JavaType<?> javaType) {
37-
return javaType.getClass() == UnknownBasicJavaType.class;
37+
return javaType == null || javaType.getClass() == UnknownBasicJavaType.class;
3838
}
3939
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Hibernate, Relational Persistence for Idiomatic Java
3+
*
4+
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
5+
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
6+
*/
7+
package org.hibernate.orm.test.query.hql;
8+
9+
import org.hibernate.testing.orm.domain.StandardDomainModel;
10+
import org.hibernate.testing.orm.junit.DomainModel;
11+
import org.hibernate.testing.orm.junit.Jira;
12+
import org.hibernate.testing.orm.junit.SessionFactory;
13+
import org.hibernate.testing.orm.junit.SessionFactoryScope;
14+
import org.junit.jupiter.api.Test;
15+
16+
import java.util.List;
17+
18+
import static org.junit.jupiter.api.Assertions.assertEquals;
19+
20+
@DomainModel(standardModels = StandardDomainModel.GAMBIT)
21+
@SessionFactory
22+
public class InTests {
23+
24+
@Test
25+
@Jira("https://hibernate.atlassian.net/browse/HHH-19698")
26+
public void testInWithNullLiteral(SessionFactoryScope scope) {
27+
scope.inTransaction(
28+
session -> {
29+
assertEquals(0, session.createQuery("select 1 where 1 in (null)", Integer.class).list().size());
30+
}
31+
);
32+
}
33+
34+
}

0 commit comments

Comments
 (0)