Esempio n. 1
0
 public Team getTeam(Team teamSelection) {
   Session session = SessionFactoryUtil.getInstance().getCurrentSession();
   Transaction transaction = session.beginTransaction();
   Team team =
       (Team)
           session
               .createQuery("from Team as team where team.id = " + teamSelection.getId())
               .uniqueResult();
   transaction.commit();
   return team;
 }
Esempio n. 2
0
 public List<User> getUsersForTeam(Team team) {
   Session session = SessionFactoryUtil.getInstance().getCurrentSession();
   Transaction transaction = session.beginTransaction();
   List list =
       session
           .createQuery(
               "from TeamUserSelection as teamUserSelection where teamUserSelection.idteam= "
                   + team.getId())
           .list();
   transaction.commit();
   if (list != null) {
     List<User> result = new ArrayList<User>();
     for (Object o : list) {
       User user = getUser(((TeamUserSelection) o).getIduser());
       result.add(user);
     }
     return result;
   }
   return null;
 }