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

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

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

unit testing - How to mock PreferenceManager in Android? -