How to ignore "request cannot be resolved" error in IntelliJ

I have a request:

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

      

And IntelliJ IDE warns about the error: Can't resolve the query parameter, I believe because the column is "timestamp" (I know it's a bad name, but it defined a decade ago, I can't change it).

Is there anyway I can ignore this error?

+3


source to share


2 answers


You may be able to avoid the warning by specifying the column name using double quotes, backreferences, or parentheses. This is a common SQL mechanism to allow unusual column names such as spaces or reserved words and can help IntelliJ parse it better.



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

      

+2


source


Navigate to the part of the code where the error is highlighted, click ALT+ ENTERand select the option "Validate unresolved requests and query parameters" → Change validation profile parameters. This will open a preferences dialog where you can uncheck this check so that future "errors" of this type are ignored.

You can also change it directly from the settings. Just search for an unresolved request.



Btw: This validation is shown as JPA validation, but clearly it works for plain JDBC too.

+6


source







All Articles