A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Object Relational Mapping
get a sql query
Joined: Nov 25, 2008
Jul 23, 2009 22:49:27
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?
Joined: Apr 14, 2004
Jul 24, 2009 01:53:28
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.
Joined: Nov 22, 2003
Jul 24, 2009 21:46:57
did you try setting show_sql property in hibernate config and able to see the sql that it generated?
Cameron Wallace McKenzie
author and cow tipper
Joined: Aug 26, 2006
Jul 25, 2009 06:41:10
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.
I agree. Here's the link:
subject: get a sql query
Hibernate 3.0 Questions
hibernate left join not working
Stored Procedure inside HQL query?
How to Convert HQL to SQL Query
hibernate undefined alias : 1 error
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014