java - JPA and Hibernate - Criteria vs. JPQL or HQL -
what pros , cons of using criteria or hql? criteria api nice object-oriented way express queries in hibernate, criteria queries more difficult understand/build hql.
when use criteria , when hql? prefer in use cases? or matter of taste?
i prefer criteria queries dynamic queries. example easier add ordering dynamically or leave parts (e.g. restrictions) out depending on parameter.
on other hand i'm using hql static , complex queries, because it's easier understand/read hql. also, hql bit more powerful, think, e.g. different join types.
Comments
Post a Comment