How to test HQL queries?

environment, hibernate, hql, java, testing

Solution

With Intellij IDEA 8.1.3 the mechnism of choice is called 'Facet'. To instantly test HQL queries:

- create a data source Tools -> Data Source, Add Data Source, define driver, username and password of yor development db

- in case you dont have already a hibernate.cfg or you configure your session factory in a different way than via xml: create a hibernate.cfg file referencing all XML mapping's (define a name for the session factory, just for easier handling)

- in 'Project Structure' add Facet to your module of choice and assign the recently defined data source to the new facet

- switch to Java EE View

- Open Hibernate Facets - Node

- Right click Session factory and choose "Open HQL Console"

- enter HQL query in console ...and your're done.

sorry for this RTFM question.

Problem

I'm searching for a fast (really fast) way to test changes to hibernate queries. I have a huge application with thousands of different HQL queries (in XML files) and 100+ mapped classes and i dont want to redeploy the whole application to just test one tiny change to a query. How would a good setup look like to free me from redeployment and enable a fast query check?

Original source