@Override
    public ArrayList<Integer> findByType(String type) {
        ArrayList list = new ArrayList();
        try {
            connection = getConnection();
            ptmt = connection.prepareStatement("SELECT id FROM Task WHERE type=?;");
            ptmt.setString(1, type);
            resultSet = ptmt.executeQuery();
            while (resultSet.next()) {
                list.add(resultSet.getInt("id"));
            }
        } catch (SQLException ex) {
            Logger.getLogger(UserTypesDAO.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            try {
                if (ptmt != null) {
                    ptmt.close();
                }
                if (connection != null) {
                    connection.close();
                }
                if (resultSet != null) {
                    resultSet.close();
                }
            } catch (SQLException ex) {
                Logger.getLogger(UserTypesDAO.class.getName()).log(Level.SEVERE, null, ex);
            }

        }
        return list;
    }