Skip to content

Commit 1151993

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

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-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: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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.dialect.DerbyDialect;
10+
import org.hibernate.testing.orm.domain.StandardDomainModel;
11+
import org.hibernate.testing.orm.junit.*;
12+
import org.junit.jupiter.api.Test;
13+
14+
import java.util.List;
15+
16+
import static org.junit.jupiter.api.Assertions.assertEquals;
17+
18+
@DomainModel(standardModels = StandardDomainModel.GAMBIT)
19+
@SessionFactory
20+
public class InTests {
21+
22+
@Test
23+
@Jira("https://hibernate.atlassian.net/browse/HHH-19698")
24+
@SkipForDialect(dialectClass = DerbyDialect.class, reason = "Derby doesn't like null literals in the in predicate")
25+
public void testInWithNullLiteral(SessionFactoryScope scope) {
26+
scope.inTransaction(
27+
session -> {
28+
assertEquals(0, session.createQuery("select 1 where 1 in (null)", Integer.class).list().size());
29+
}
30+
);
31+
}
32+
33+
}

0 commit comments

Comments
 (0)