Hibernate HQL console and inspections
Introduction#
Intellij IDEA supports HQL auto completion and running HQL queries on console. This is how you enable that support.
Configuring HQL Inspections
- Go to File -> Project Structure -> Modules.
- Add new Hibernate module.
- Right click on the desired module -> Add -> Hibernate.
- Select the newly created Hibernate configuration option, and click the (+) sign in the right pane to create hibernate.cfg.xml file.
- Go to File -> Project Structure -> Facets, and add new JPA.
- Select the newly created JPA configuration option, and click the (+) sign in the right pane to assign it your Hibernate configuration file.
- Open Persistence window, there you should see the list of your project modules.
- Expand the module name, and assign your data source to the hibernate.cfg.xml file.
Now you can write queries on hibernate console and get HQL auto completion.