I'm using Spring Boot 1.4.2 and both Hibernate and JPA in my project. I use IntelliJ Community 2016.2.4, same as my colleague. The difference is that when he types something in HQL (i.e. @Query("SELECT id FROM usesrs)) it automatically checks the table names against the real DB structure - there is no "usesrs" table, but there is a "user" table. So his project doesn't compile unless he corrects it - what a wonderful feature! Sometimes it takes me a lot of time to spot such bugs...
Can you tell me how can I enable this in IntelliJ? What I tried:
1) When I go to Preferences / Editor / Language injections / "+" sign / Java Parameter I don't see SQL on the list, not speaking about HQL (but JQL is there which is crazy...). Anyway looks like I want to enable something deeper than just plain syntax check, it has to check against the database structure.
2) When I go to File / Project structure / Facets / "+" sign I don't see JPA there, just some Android options and Java-Gradle.
Any suggestions here?
Unfortunate JPA/Hibernate features are supported in the Ultimate version.

IDEA has the Language Injections which can inject a language (such as SQL, RegExp, XML, HTML, CSS, etc.) into a string literal in your code and, as a result, get comprehensive coding assistance when editing that literal.
You can get a help here and a tip here to Using language injections in SQL
In the Database view is your datasource setup?
If it's not already visible go to view -> Tool Windows -> Database
There you should see a data source for your connection.
If it is not there you'll need to set it up using + -> "Data Source" then select the DB that your using and set up your connection.
Once this is done OR if the DB Connection is already present you'll want to synchronize the datasource using the "Refresh" looking icon in the Database view.
Then click on more schemas and pick the schema your using and hit Synchronize on that as well. Intellij should now know about the DB and your table structures.
Hopefully it can then check your queries automatically unless there is something else amiss.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With