V / s HQL criteria. Who quickly?

I read a few anvers, but I'm still confused. What for? because the differences you mentioned are not related to performance. they are associated with easy use. (Objetc (criteria) and SQL (hql)). But I would like to know why the โ€œcriteriaโ€ are slower than hql for some reason.

I read it in another andreva

โ€œThere is a difference in performance between HQL and the Query criterion, every time you run a query using the Query criterion, it creates a new alias for the table name that is not reflected in the last requested cache for any database. This leads to overhead for compiling the generated SQL that takes longer to complete. " Varun Mehtoy.

This is very close, BUT! I am reading on another website (http://gary-rowe.com/agilestack/tag/hibernate/) This is no longer true for Hibernate 3.3 and above (please read the following: 9) Hibernate is slow because SQL, generated Criterion Interface is not consistent)

I did some tests trying to figure out the differences, but both generate qry and this does not change the alias to the table.

I am very confused. If someone knows the root cause, please, could you help us. Thanks

+3
source share
1 answer

In general, if you use HQL or Criteria to create your latest SQL, you will not see much performance difference in later versions of Hibernate (version 3.3 and higher).

, HQL, Criteria. SQL Hibernate (, Maven ). , Hibernate SQL.

HQL , . , , , - .

, , ( ):

9) " , SQL Criteria, "

, Criteria HQL. , , , DAO, Hibernate . Oracle , run, QEP - - SQL, . QEP 30% , Oracle SQL-, ( ) SQL-, , 50% , HQL.

Hibernate 3.3 . - , , , , SQL , . , , , . Oracle.

, , , , , HQL, . . , "" 3 . HQL , , , .

, , , , , Criteria , HQL. HQL , .

, , .

+7

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


All Articles