gpt4 book ai didi

hibernate - Hibernate 函数 Restrictions.allEq(Map) 如何处理空值?

转载 作者:行者123 更新时间:2023-12-01 23:51:41 26 4
gpt4 key购买 nike

我想知道 Hibernate 如何运行 Restrictions.allEq(Map<String, Object> ...)处理输入 Map 中的空值(如果是多个 Restrictions.eq(String, Object)Restrictions.eqOrIsNull(String, Object) )或其他)。
从 Google 快速搜索后,我无法从 Hibernate 文档中找到任何具体内容,只有一个消息来源说 Restrictions.allEq(...)相当于multiple Restrictions.eq(String, Object) (参见 here)。
我不确定这是正确的答案,所以我在这里问。提前谢谢大家

最佳答案

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

关于hibernate - Hibernate 函数 Restrictions.allEq(Map<String, Object>) 如何处理空值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26143239/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com