• 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
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Difference between HQL and DetachedCriteria

 
Ranch Hand
Posts: 83
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,
I m using Hibernate 3.0. I am little new to hibernate. For getting the data from database, i am using DetachedCriteria and also HQL(Hibernate Query Language). Difference between HQL and DetachedCriteria.


I want to know that in which situation i use DetachedCriteria
and in which situation i use HQL?

and also tell what is the difference between them and drawbacks over each other?

Please try to help my problem.

Hoping for a very good reply.

Regards,
Jagrut
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HQL allows you to query the database based on the relationships between your objects, in a way that mimics SQL, but in a very object-oriented manner.

A criteria query uses the Hibernate Criteria API to programatically create queries based on your objects, and various classes such as restriction and example.

Here's an HQL Example from my Hibernate Query Language Tutorial:





Here's a Hibernate Criteria Example from my tutorial on using the Hibernate Criteria API:




-Cameron McKenzie
 
We don't have time for this. We've gotta save the moon! Or check this out:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic