Im using Jdbctemplate and trying to set a boolean value inside the mapRow method. But it doesnt allow, It says
Cannot refer to a non-final variable isEveryTransactionNotClosed inside an inner class defined in a different method
Here is my code
public boolean isEveryTransactionNotClosed (String txIds) throws QiibException {
String sql = "<Query> ";
logger.info("isEveryTransactionNotClosed SQL :"+sql);
boolean isEveryTransactionNotClosed = true;
try {
isEveryDealNotClosed = getJdbcTemplate().queryForObject(sql, new Object[] {dealIds},
new RowMapper<Boolean>() {
public Boolean mapRow(ResultSet rs, int rowNum) throws SQLException {
if (!rs.next()) {
isEveryTransactionNotClosed = false; -->
}
}
});
} catch(EmptyResultDataAccessException e) {
logger.error("Empty result data - isEveryTransactionNotClosed ");
}
return isEveryTransactionNotClosed ;
}
How can I use isEveryTransactionNotClosed inside class?