public List<HockeyMatch> findAllByChampionship(Championship championship) { dao.openCurrentSession(); List<HockeyMatch> matches = dao.findAll(); dao.closeCurrentSession(); matches = matches .stream() .filter(match -> match.getChampionship().equals(championship)) .collect(Collectors.toList()); return matches; }
public List<HockeyMatch> findAll() { dao.openCurrentSession(); List<HockeyMatch> books = dao.findAll(); dao.closeCurrentSession(); return books; }