Java – why is standard query not recommended in Hibernate 5?

As we already know, the standard query in Hibernate 5 has been deprecated In previous versions of hibernate, this was a very useful feature It still performs better than HQL

So what is the reason why it is discarded in Hibernate 5?

And this problem is not a repetition of this question, because I want to know the reason why the standard query is discarded

This is from here

Solution

We disapprove of using criteria API instead of JPA extension support

Consider this:

CriteriaBuilder cb = entityManager.getCriteriaBuilder();
HibernateCriteria hc = cb.unwrap( HibernateCriteria.class );
...
query.where( hc.someAwesomeThing( ... ) );
List<SomeEntity> entities = entityManager.createQuery( query ).getResultList();

Contrary to our opinion, we intend to continue to provide hibernate specific functions, but we want to introduce these functions through the standard API, rather than trying to manage two complementary APIs that maintain very different synchronization

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>