How to get Intellij to recognize Hibernate <-> DB issues/errors?

The project I'm working on uses Java EE, Srping, Hibernate and MySql. Intellij is far more helpful than eclipse in my experience but there are instances where traking down some typo in a Hibernate or Spring xml file wastes tons of time. To get right to the point, I would like to know if it is easily possible to get Intellij to recognize that the table field (table="some_incorrect_table") in a hibernate xml file doens't match the porperties (<property name="orderId" type="java.lang.String" column="order_id"/>)  in that same xml file. In other words, recognize that the columns listed in the properties do not match the columns that are in the tablr. Currently Intellij has no knowledge of the tables and columns of each table. I would like to simply explicitly define them instead of setting up a DB connection with intellij. I want to just be able to specify the tables and columns of each table and have intellij use that information to alert me of hibernate mapping issues. Can this be done?

1 comment
Comment actions Permalink

You need to enable JavaEE, Database Tools and Hibernate plugins in Settings | Plugins.

See
https://www.jetbrains.com/idea/features/jpa_hibernate.html
https://www.jetbrains.com/idea/help/relational-databases.html

In the Persistence toolwindow one can assign a configured data-source with hibernate session factory.
Then there's a special inspection that highlights missing/incorrect tables and columns in JPA annotations and *.hbm.xml.
Inspections can be enabled and disabled in Settings | Editor |  Inspections

0

Please sign in to leave a comment.