How to ignore "cannot resolve query parameter" error in IntelliJ

I have a query:

Date dDateFrom; ... String sql = "select a from tblA where timestamp > ?"; ps = this.connection.prepareStatement(sql); ps.setTimestamp(1, java.sql.Timestamp(dDateFrom.getTime()));

And the IntelliJ IDE warn an Error: cannot resolve query parameter, I believe it's because the column "timestamp", (I know it's a bad name, but it's defined decade ago, I can not change it).

Anyway I can ignore this error?

-------------Problems Reply------------

You might be able to avoid the warning by quoting the column name with double-quotes, backticks, or brackets. This is the usual SQL mechanism for allowing unusual column names such as spaces or reserved words, and could help IntelliJ parse it better.

String sql = "select a from tblA where \"timestamp\" > ?";

Navigate over the part of the code where the error is highlighted, hit ALT+ENTER and select Inspection 'Unresolved queries and query parameter' options -> Edit inspection profile settings. This will open settings dialog where you can uncheck this inspection so that future "errors" of this kind will be ignored.

You can also change it directly from Settings. Just search for Unresolved query.

Btw: this inspection is shown as a JPA inspection, but clearly it works for plain JDBC too.

Category:intellij idea Views:0 Time:2018-02-12

Related post

Copyright (C), All Rights Reserved.

processed in 0.209 (s). 11 q(s)