I am a bit confused about these three concepts.
- Criteria API
- Query Dsl
- Jpa 2.0 meta model
From what I have read, One of the major benifits of using QueryDsl or JPA metamodel is type safety.
But I can achieve type safety even with Criteria API's. (I am using JPA with eclipselink)
javax.persistence.EntityManager has two variants
public Query createQuery(String sqlString);
public <T> TypedQuery<T> createQuery(CriteriaQuery<T> criteriaQuery);
I agree with first version where I pass sql as string I don't get type safety. But with the second version I get type safety. Or am I missing something here? Can someone explain with an example how using criteria is not type safe.
What is the difference between QueryDsl and JPA static meta model ?