Why is criteria query deprecated in Hibernate 5?

前端 未结 1 414
渐次进展
渐次进展 2020-12-28 12:54

As we already know, criterion query is deprecated in Hibernate 5. It was such a useful feature in the previous versions of Hibernate. A

相关标签:
1条回答
  • 2020-12-28 13:35

    We are deprecating the Criteria API in lieu 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 comments, we do intend to continue to deliver Hibernate-specific features, but we want to introduce those through the standard API instead rather than trying to manage keeping two very different APIs that are meant to be complementary in sync.

    0 讨论(0)
提交回复
热议问题