• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

when to use HQL and when to use Criteria?

 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When to use HQL and When to use creteria?
i) I mean is there any particular condition where I can use only creteria and
not HQL or vice versa?
ii) In which condition it is better to use creteria or vice versa?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Personal preference is about all there is to differentiate. Criteria have the advantage of not being open to syntax errors, HQL is (to my mind) easier to understand, since it looks pretty much like SQL. I suppose dynamic, adhoc queries ar easier to implement in HQL too.
 
reply
    Bookmark Topic Watch Topic
  • New Topic