Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. //service
  2. public List<TEAM> getTeamsInTournament(int tournamentID){
  3. List<BigDecimal> teamIDS = dao.getTeamIDSInTournament(tournamentID);
  4. List<TEAM> teamList = new ArrayList<>();
  5. for(BigDecimal teamId : teamIDS){
  6. teamList.add(teamService.getTeamByID(teamId.intValue()));
  7. }
  8. return teamList;
  9.  
  10. }
  11. //dao
  12. public List<BigDecimal> getTeamIDSInTournament(int tournamentID) {
  13. String queryStr = String.format("select TEAMID from TEAM_TOURNAMENT where TOURNAMENTID=%d", tournamentID);
  14. Query query = entityManager.createNativeQuery(queryStr);
  15. List<BigDecimal> teamList = query.getResultList();
  16. return teamList;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement