我很好奇 CriteriaQuery<T>#where(List<Predicate>)
的缺失.
我明白了orderBy(List<Order>)
, multiselect(List<Selection<?>>)
和groupBy(List<Expression<?>>)
.
为什么where(List<Predicate>)
没有方法?这有什么技术原因吗?
最佳答案
where(..) 方法没有签名:where(List<Predicate>)
。从实现的角度来看,内部通常使用列表来存储谓词。对于方法where(Predicate ...)
,数组将转换为列表。所以where(List<Predicate>)
比where(Predicate ...)
更有效率。应向 JPA 规范提交请求。
关于java - 为什么没有 CriteriaQuery<T>#where(List<Predicate>)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52252121/