• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

get a sql query

 
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need to get a sql query of a given Hql query.how can i do that?
when i am running a debugging it gives error at line "query.list ".
so i need to convert my HQL to sql .then i can find the error?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error is unlikely to be a SQL error, unless there is a bug in whichever dialect you are using. Its more likely an HQL error. Can you post the stacktrace?

For reference, the hibernate.show_sql property will log the SQL hibernate generates.
 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you try setting show_sql property in hibernate config and able to see the sql that it generated?
 
author and cow tipper
Posts: 5000
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When SQL gets generated, you can usually see it in the log file output. You can copy and paste the SQL into a database console window or something and execute the SQL and see how well it works.

If you're converting SQL to HQL, remember that HQL is object centric. You won't have primary keys, but your objects should have identifiers or ids.

-Cameron McKenzie
 
Mo-om! You're embarassing me! Can you just read a tiny ad like a normal person?
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!