Is there Hibernate criteria like queries in JPA?
2 Answers
As said above it exists but i don't really like it. You should read that blog article which tell you how to use JPA Criteria with Spring-Data or Querydsl: http://blog.springsource.org/2011/04/26/advanced-spring-data-jpa-specifications-and-querydsl/
2 Comments
madth3
I agree. Criteria queries is one of the JPA 2 features I don't use. At least not directly.
bennidi
So true. The criteria api from jpa is not well designed. the article about the specification pattern shows better ways of implementing type safe queries. I wonder why this is not something the "expert group" could come up with...#
JPA 2.0 has it. Refer [1] from OpenJPA.
[1] http://openjpa.apache.org/builds/latest/docs/manual/jpa_overview_criteria.html