4

JPA Criteria API has some important limitations. For example:

  • no support for right-outer-join
  • support for left-outer-join only if the relation in the entities is in the same direction
  • no support for subquery neither in SELECT nor in FROM clauses

Does QueryDsl querydsl-jpa suffer from the same limitations?

What about QueryDsl querydsl-sql?

EDIT: From the QueryDsl documentation (no concrete experience with it), QueryDsl provides two query-classes JPAQuery and JPASQLQuery. The first seems to have the same limitation as JPA Criteria API, but JPASQLQuery doesn't seem. If I find time, I will dive deeper into code and try it. But if someone already knows something about it, then you are welcome!

jeromerg
  • 2,997
  • 2
  • 26
  • 36
  • 4
    The Criteria API makes me want to cry every time I see it. I'd use QueryDSL every time regardless of any limitations it may have (not that I'm saying there are any). – Alan Hay May 13 '14 at 09:52
  • 1
    Interesting. Please fell free to add argumentation! – jeromerg May 13 '14 at 10:37

1 Answers1

1

You assumption is correct. Querydsl JPA has the same restrictions as the mentioned three restrictions are also restrictions of JPQL, the query language of JPA.

JPAQuery is for JPQL queries and JPASQLQuery is for JPA native (SQL) queries.

Timo Westkämper
  • 21,824
  • 5
  • 78
  • 111
  • Thank you Timo Westkämper! Just to clarify: `JPAQuery` has the same limitations as JPQL but `JPASQLQuery` don't. Is that correct? (I get confused with the name "Querydsl JPA": does it represent `JPAQuery` only, or `JPAQuery` and `JPASQLQuery` together. – jeromerg May 14 '14 at 22:29
  • You are correct. Querydsl JPA is Querydsl integration for the JPA API queries, JPQL (JPAQuery) and SQL (JPASQLQuery). – Timo Westkämper May 15 '14 at 15:50