• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

JPA Query and HQL

 
Ranch Hand
Posts: 774
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I am quiet new to Hibernate and JPA. I started hibernate before but left it because of other demands.
I am currently using JPA and Hibernate as a persistance provider integrated with Spring. I have a question,
that when we write query statements, can we directly write HQL in JPA. Will that work or we have to write
queries specific to JPA.

Please help,
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can consider JPA query language as a sub set of HQL. HQL supports all JPA QL features and provides additional ( vendor specific) extensions like Criterion, Query By Examples...etc.

If you use JPA queries , your application will be less coupled with hibernate.
 
Prithvi Sehgal
Ranch Hand
Posts: 774
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Thanks for your quick turn-around.

On note of that, i have another question. What will be best practice, what query language to use, when you are using
JPA but persistance provider as Hibernate? Will HQL be the appropriate choice or JPA own query language?

Best Regards,
 
Reddy Prashanth
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I prefer JPA queries as much as possible. But if your application is using hibernate implementation and if there is no plans in future to move off from hibernate, you can also use Hibernate Queries.
 
I don't like that guy. The tiny ad agrees with me.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic