java为什么Hibernate 5中不推荐使用条件查询?
正如我们已经知道的,标准查询在Hibernate 5中不推荐使用。在以前的Hibernate版本中,这是一个非常有用的特性并且它仍然比HQL性能更好
那么,它在Hibernate 5中被弃用的原因是什么呢
而且这个问题不是this question的重复,因为我想知道反对条件查询的原因
这是来自here.
Hibernate offers an older, legacy
org.hibernate.Criteria
API which should be considered deprecated. No feature development will target those APIs. Eventually, Hibernate-specific criteria features will be ported as extensions to the JPAjavax.persistence.criteria.CriteriaQuery
. For details on theorg.hibernate.Criteria
API, see Legacy Hibernate Criteria Queries.
# 1 楼答案
我们反对使用CriteriaAPI代替JPA扩展支持
考虑如下:
与评论相反,我们确实打算继续提供特定于Hibernate的特性,但我们希望通过标准API来引入这些特性,而不是试图保持两个完全不同的API的同步