How to fix error "Cannot resolve column..."

For those who just want to disable this check, go to Intellij IDEA -> Preferences -> Search "Unresolved database references in annotations" and uncheck it. enter image description here (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.


Open Persistence tool windows, right click on module, then set DataSource. IntelliJ IDEA will validate source code by real SQL database. enter image description here


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:

  • try restarting Pycharms.
  • go to options (command + ,), 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