java - 为什么没有 CriteriaQuery<T>#where(List<Predicate>)?

标签 java jpa criteria-api

我很好奇 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/

相关文章:

java - JPA2 Criteria API : What is the difference between using Entity. 类和 from 子句中元模型的 EntityType

java - @Test(expected = Exception.class) 或 Assertions.assertThrows(...) 或assertThatThrownBy(..) 推荐哪一个?

java.sql.SQLException : No suitable driver found for url+dbName, UserId=?&password=?

java - 使用 Selenium 进行 Spring MVC 集成测试

java - @Scheduled @Transactional lazy init 集合错误 - 没有代理

java - 如何在Spring数据查询中获取instanceof对象

java - 加入两个不同的ExecutorService

jpa - 使用 JPQL 更新和加入

java - 如何在运行时为嵌套属性创建 CriteriaBuilder 表达式?

java - JPA 查询比较列表