Пример #1
0
  @Override
  public void delete(Long id) {
    // delete associated entries from TEAM and TEAM_PERSON tables, but not from the PERSON table
    Team team = get(id);
    if (team == null) return;

    for (Person p : team.getMembers()) {
      teamPersonDao.delete(new TeamPerson(team.getId(), p.getId()));
    }
    teamDao.delete(team.getId());
  }
Пример #2
0
 @Override
 public Team save(final Team team) {
   long id;
   if (team.getId() == null) {
     id = insertWithTxCallback(team);
   } else {
     id = update(team);
   }
   return get(id);
 }
Пример #3
0
 private void getTeamMembers(Team team, TeamPersonDao teamPersonDao, PersonDao personDao) {
   List<TeamPerson> teamPersonList = teamPersonDao.findByTeamId(team.getId());
   for (TeamPerson tp : teamPersonList) {
     team.addMember(personDao.get(tp.getPersonId()));
   }
 }