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

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -