Criteria for HQL

Is there any way to take a criterion (having several criteria, restrictions and orders) and derive an HQL query from it?

Greetings

Nick

+3
source share
1 answer

Unfortunately, the criteria API is not well thought out.

While the fact that it will not generate HQL for you is understandable (in any case, the criteria are an alternative to HQL), there is no way to do it yourself - not without fixing the Hibernate code. The class of criteria is a one-way street; he supports all the conditions / associations / etc. that you have provided to him, but does not provide you with a way to return them.

Hibernate Generic DAO, ( ). , API- Criteria:-), QL, Hibernate JPA ( )

+1

Source: https://habr.com/ru/post/1724105/


All Articles