2

I'm looking for a way to test HQL queries using IntelliJ IDEA v.10 (Ultimate Edition). I've read the instructions in the accepted answer of this question, but they refer to IDEA v.8 and don't seem to work in more recent versions of IDEA.

If it's not possible to do this in IDEA, then alternative suggestions for testing Hibernate queries would be welcome, though I'd prefer not to have to use Eclipse, if possible

Community
  • 1
  • 1
Dónal
  • 185,044
  • 174
  • 569
  • 824

2 Answers2

2

I have IntelliJ IDEA 11. I will describe it for this version. I hope it's similar.

  1. In Data Sources you have to add new datasource. Idea can import if from your hibernate Hibernate or JPA config.
  2. In menu Run -> Edit configuration ...
  3. Create Query Language Console runner. Use default context is your datasource.
  4. Run prepared runner and then you can write HQL or SQL. It depends on your datasource type.
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
chalimartines
  • 5,603
  • 2
  • 23
  • 33
0

There are some UI differences in new IDEA versions, but it mostly the same.

  1. Data Sources Tool Window is available if you have Database Support plug-in enabled, you don't need to use the Tools menu.

  2. Hibernate facet needs Hibernate plug-in enabled.

  3. Instead of Java EE View there is Persistence tool window from where you can Open Query Console.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904