java - 以下在 where 子句中使用 null 的 HQL 查询有什么区别?

标签 java null hql

遵循HQL

有什么区别
1. "from Object where field is null"
2. "from Object where field = null"

以上说法哪一项是正确的?如何在HQL中调用null

最佳答案

在 ANSI SQL 中,“Null = Null”为您提供 Null,而不是 true,因此,如果您尝试选择某个值等于 null 的位置,其中答案需要为“是,它是 null”,那么您需要使用“is null”。

关于java - 以下在 where 子句中使用 null 的 HQL 查询有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14965133/

相关文章:

java - 将使用 Latin-1 代码页编码的 UTF-8 转换为 iso-8859-1 字节

java - ConcurrentHashMap 中的 keySet(VmappedValue) 究竟是如何工作的?

.net - 对空字符串和 DBNull 感到困惑

iOS、JSON-RPC 和 NSJSONSerialization : Dealing with null values

java - hibernate HQL 中的 "where exists"

java - 在 XML 中显示 Java 的设备名称 (Android Studio)

Java BufferedWriter 导出文件/目录列表 .replaceAll 替代方案?

Mysql 无法添加或更新子行 外键约束失败 ON DELETE NO ACTION ON UPDATE NO ACTION

java - hibernate 过滤器不适用于子选择查询

mysql - 在 FROM 中使用子查询进行 HQL