public void createTeams() { Season season1 = seasonRepository.findByYear(2015); Season season2 = seasonRepository.findByYear(2016); Team team1 = new Team(); team1.setName("Unicaja"); cal.set(1977, Calendar.FEBRUARY, 8); team1.setCreation(cal.getTime()); team1.setLocation("Malaga"); teamRepository.save(team1); season1.getTeams().add(team1); seasonRepository.save(season1); Team team2 = new Team(); team2.setName("Bruixa d'Or"); cal.set(1980, Calendar.JUNE, 15); team2.setCreation(cal.getTime()); team2.setLocation("Manresa"); teamRepository.save(team2); season2.getTeams().add(team2); seasonRepository.save(season2); Team team3 = new Team(); team3.setName("F.C Barcelona"); cal.set(1969, Calendar.NOVEMBER, 5); team3.setCreation(cal.getTime()); team3.setLocation("Barcelona"); teamRepository.save(team3); season1.getTeams().add(team3); seasonRepository.save(season1); Team team4 = new Team(); team4.setName("Real Madrid"); cal.set(1971, Calendar.SEPTEMBER, 16); team4.setCreation(cal.getTime()); team4.setLocation("Madrid"); teamRepository.save(team4); season2.getTeams().add(team4); seasonRepository.save(season2); Team team5 = new Team(); team5.setName("BilbaoBasket"); cal.set(1990, Calendar.JUNE, 30); team5.setCreation(cal.getTime()); team5.setLocation("Bilbao"); teamRepository.save(team5); season1.getTeams().add(team4); seasonRepository.save(season1); }
public void createSeasons() { League league1 = leagueRepository.findByNameLike("ACB"); Season season1 = new Season(); season1.setYear(2015); season1.setName("ACB 15-16"); season1.setLeague(league1); seasonRepository.save(season1); Season season2 = new Season(); season2.setYear(2016); season2.setName("ACB 16-17"); season2.setLeague(league1); seasonRepository.save(season2); }