Monday, March 29, 2010

Using HQL Console for JPA facet in Intellij

You got a complicated HQL or JPAQL in your code that has some problems, you need to verify what exactly the query is doing, how should you go ahead to test run it in your database? One option is that you can read the HQL or JPAQL and manually translate it to SQL statement and run the sql statement in your Database, however, this method is error prone and tedious. Another option is use the HQL Console came with Intellij, I found this method is easy and more accurate comparing to the previous options. Here is how I did it:
  • Create a DataSource in Intellij, let's name it datasource_1
  • Go to the Project->View:J2EE structure->right click the module your pojos are located in, edit the JPA facet properties to set datasource_1 maps to the desired Persistent Unit, and set the default JPA provider to: Hibernate.
  • Project->View:J2EE structure->right click the Persistent Unit, you should be able to start HQL Console.
  • You can paste your HQL or JPAQL in the HQL Console and try it out, or you can generate SQL for it and run the SQL in your DB.
Update: In Intellj 9, there is a little bit change where you can find the Persistent Unit to start HQL Console, you should click the Persistence tab on the left corner of Intellij 9.

3 comments:

Mithun said...

Comprehensive Contents are make Understand the Concept Easily.Thanks fro such a Creative works...Keep it up!!!
Java training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery

Samia Beel said...

Run Pinnacle Game Profiler as Administrator. If your Pinnacle Game Profiler not working on Windows 10, then the first way to fix this issue is to Pinnacle Game Profiler Crashes

Raja Khuram said...

tally erp 9 with crack full version zip Download that provides highly efficient accounting functions is available. Formula creators can eliminate errors Tally 9 With Crack Full Version Zip

Full Guide for using Bitnami Prometheus Operator Helm Chart with Additional Scrape Configuration

"The Prometheus Operator for Kubernetes provides easy monitoring definitions for Kubernetes services and deployment and management of...