Example usage for org.springframework.jdbc.core JdbcTemplate queryForRowSet

List of usage examples for org.springframework.jdbc.core JdbcTemplate queryForRowSet

Introduction

In this page you can find the example usage for org.springframework.jdbc.core JdbcTemplate queryForRowSet.

Prototype

@Override
    public SqlRowSet queryForRowSet(String sql) throws DataAccessException 

Source Link

Usage

From source file:org.agnitas.dao.impl.ImportRecipientsDaoImpl.java

@Override
public Set<String> loadBlackList(int companyID) throws Exception {
    final JdbcTemplate jdbcTemplate = createJdbcTemplate();
    SqlRowSet rset = null;//from w ww . j  a  v a 2s.com
    Set<String> blacklist = new HashSet<String>();
    try {
        if (AgnUtils.isOracleDB()) {
            // ignore cust_ban_tbl so that global blacklisted addresses can be imported to local blacklist
            rset = jdbcTemplate.queryForRowSet("SELECT email FROM cust" + companyID + "_ban_tbl");
        } else {
            rset = jdbcTemplate.queryForRowSet("SELECT email FROM cust_ban_tbl");
        }
        while (rset.next()) {
            blacklist.add(rset.getString(1).toLowerCase());
        }
    } catch (Exception e) {
        logger.error("loadBlacklist: " + e.getMessage(), e);

        throw new Exception(e.getMessage());
    }
    return blacklist;
}