@Override
    public Team findTeamByID(Long id) {
        checkDataSource();
        if (id == null) {
            throw new IllegalArgumentException("id is null");
        }
        try (Connection conn = dataSource.getConnection();
                PreparedStatement st = conn.prepareStatement("SELECT id,name,coach,status FROM TEAMS WHERE id = ?")) {
            st.setLong(1, id);

            ResultSet rs = st.executeQuery();

            if (rs.next()) {
                Team team = resultSetToTeam(rs);

                if (rs.next()) {
                    throw new ServiceFailureException("Internal error: More entities with the same id found "
                            + "(source id: " + id + ", found " + team + " and " + resultSetToTeam(rs));
                }
                return team;
            } else {
                return null;
            }

        } catch (SQLException ex) {
            String msg = "error when selecting team with id" + id;
            Logger.getLogger(TeamMngrImpl.class.getName()).log(Level.SEVERE, msg, ex);
            throw new ServiceFailureException(msg);
        }

    }