JPQL查询-'in','is not null'和'='正在提取null值

时间:2019-02-20 15:58:32

标签: sql oracle jpql

我的JPQL存在以下问题。我正在使用Oracle 12c。

查询

select * from fooTable where id is in (select id from fooTable2 where name = 'name');

返回我想要的东西。它不包含id为null的任何记录。

在JPQL中

"select f from foo where f.id is in (select f2 from fooTable2 where f2.name = :name)"

返回name等于参数的值,还返回f.id为null的值。如果我添加到我的位置

"select f from foo where f.id is in (select f2 from fooTable2 where f2.name = :name) and f.id is not null" 

它仍将返回空值。我还尝试过不是EMPTY,认为JPQL to SQL正在将null和空字符串混合在一起,但是那没有用。

有人可以解释这种行为吗?

0 个答案:

没有答案