【问题标题】:How does Hibernate function Restrictions.allEq(Map<String, Object>) treat null values?Hibernate 函数 Restrictions.allEq(Map<String, Object>) 如何处理空值?
【发布时间】:2014-11-26 09:42:07
【问题描述】:

我想知道 Hibernate 函数 Restrictions.allEq(Map&lt;String, Object&gt; ...) 如何处理输入 Map 中的空值(如果是多个 Restrictions.eq(String, Object)Restrictions.eqOrIsNull(String, Object))或其他)。
从 Google 快速搜索后,我在 Hibernate 文档中找不到任何具体内容,只有消息来源说 Restrictions.allEq(...) 等同于 multiple Restrictions.eq(String, Object)(请参阅 here)。
我不确定这是正确的答案,所以我在这里问。 先谢谢大家了

【问题讨论】:

    标签: hibernate equals isnull restrictions


    【解决方案1】:

    在下载了Hibernate(4.3.6.Final)的源代码后,稍作检查,我终于找到了答案:Restrictions.allEq(Map&lt;String, Object&gt;)被翻译成一堆Restrictions.eq(String, Object),因此null值被重新映射作为字符串"null"(根据具体应用,可能是也可能不是正确的翻译)。
    就我而言,我需要使用多个 Restrictions.eqOrIsNull(String, Object) 来正确管理我的输入 Map&lt;String, Object&gt;
    我希望这个问题对其他人有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-26
      • 2020-09-15
      • 2012-03-06
      • 2018-09-22
      • 1970-01-01
      • 2013-06-16
      • 2020-07-14
      • 1970-01-01
      相关资源
      最近更新 更多