class ListenerRepo {

    public List<Listener> findByTableName(String tableName, Connection connection) {
        try (
                PreparedStatement stmt = connection.prepareStatement(FIND_BY_TABLE_NAME_QUERY)
        ) {
            stmt.setObject(1, tableName);
            ResultSet rs = stmt.executeQuery();

            List<Listener> result = newArrayList();
            while (rs.next()) {
                result.add(extractListener(rs));
            }
            return result;
        } catch (SQLException e) {
            throw new DataAccessException("Something went wrong while listing listeners for table: " + tableName, e);
        }
    }

}