I am going to start new project that would play with very large database, thus would be having lots of database operation.
I have decided to use Spring JPA as my ORM. Now Spring JPA provides various techniques to use in DAO layer. I am confused between Criteria builder and Query DSL. Both seems to solve my problem well and I guess there is not point using both of them in a same project because they provide same functionality.
So now which one to use and why ?
The JPA 2 Criteria API and Querydsl are equivalent in functionality, but Querydsl has been designed to be more fluent and look more like JPQL/SQL. So it can be used as a replacement for both JPQL and JPA 2 Criteria.
Here is also a blogpost on the topic which shows how compact Querydsl queries are in comparison to the JPA 2 Criteria API Querydsl as an alternative to the JPA 2 Criteria API
This answer is biased, since I am behind Querydsl.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With