This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes How to Convert HQL to SQL Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to Convert HQL to SQL Query" Watch "How to Convert HQL to SQL Query" New topic
Author

How to Convert HQL to SQL Query

vijay sachin
Greenhorn

Joined: Jan 18, 2011
Posts: 23
Hi All

I need to convert HQL to SQl Query is there any why I can do it.



I want to convert the above HQL Query to SQL query, Please help me how can I do it.


Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

vijay sachin wrote:Hi All

I need to convert HQL to SQl Query is there any why I can do it.



I want to convert the above HQL Query to SQL query, Please help me how can I do it.




the true SQL will depend on how entities are mapped.
look for a property


if you set that to "true", the true SQL of those hibernate queries will show up in your logs.
vijay sachin
Greenhorn

Joined: Jan 18, 2011
Posts: 23
Hi Tim,

In Hibernate.cfg.xml file I already added this property

But in log its not coming as SQL query..




HBM File



Please help me in this...



Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

Yes. In your log, this is the SQL that hibernate causes to run. Copy and paste it into a SQL tool and run it:

 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: How to Convert HQL to SQL Query
 
It's not a secret anymore!