I am developing Java web application what based on Spring Framework, MySQL, JPA. I have a problem when try to persistence data from HTML form to SQL database, then I try to debug and fix. I am using IntelliJ IDEA Ultimate 2017.1. I catch error:
Cannot resolve column 'product_name' This inspection controls whether the Persistence ORM annotations are checked against configured Datasources
This is screenshot:
How to fix it?
Open Persistence tool windows, right click on module, then set DataSource. IntelliJ IDEA will validate source code by real SQL database.
For those who just want to disable this check, go to
Intellij IDEA -> Preferences -> Search "Unresolved database references in annotations" and uncheck it.
(macOS Mojave and Intellij Ultimate 2019.3)
This will disable the inspection and remove all the "Cannot resolve column…" errors on the @Column
annotations. Intellij will stop checking if the String column names exist in the database tables. Do it at your own risk.
You have to manage your data sources. I followed the steps detailed here https://www.jetbrains.com/help/pycharm/managing-data-sources.html.
In my case, I did the following (I am using Pycharms, but I assume the process is similar for other Jetbrains IDEs):
Bring the Data sources and drivers window by going to view
> tool windows
> database
Click the wrench icon to configure the db connection
Configure it, and try that the connection works with Test Connection
Pycharms should now autocomplete fields in the db.
If it still doesn't work:
,
), then search for SQL, select menu SQL Resolution Scopes
, and try adding a scope by clicking +
, then selecting your current project folder as path, and your db as the resolution scope
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