Hello everyone,

I'm new to this forum and hoping to find help for the following problem: I load a SQL query from a file and execute it as PreparedStatement, like this:

Code:
query = loadQueryFromFile();
 
ResultSet resultSet = null;
PreparedStatement preparedStatement = null;
 
try {
    preparedStatement = connection.prepareStatement(query);    // hier meckert FindBugs
    // set parameters
    
    resultSet = preparedStatement.executeQuery();
 
    // process result set
    
} finally {
    // clean up resultSet and preparedStatement
}
Now FindBugs (1.3.9) is complaining "A prepared statement is generated from a nonconstant String" (SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING). Is there any possibility to read a query from a file which does *not* lead to this (or any other) FindBugs warning?

Thanks in advance,
Michael