1

Which of the two methods are faster especially for over 1 million rows in database? And what is best practice, to use JPQL or Criteria?

Cheers

2 Answers 2

3

The best practice is to log the SQL statements created by Hibernate and analyse their execution plans for both methods. It's really hard saying which approach would produce more optimized SQL.

Sign up to request clarification or add additional context in comments.

3 Comments

Indeed. Something like log4jdbc can help a lot there.
The people have spoken.
Well I did not expect this comment :))
1

Criteria is a more clean way to do it, the output is the same, but as best practive I recommend Criteria.

Criteria Example

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.