public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
		EntityManager entityManager = null;
		try {
			entityManager = factory.createEntityManager();
			EloPersistence persistence = new EloPersistence();
			persistence.setEntityManager(entityManager);
			SpielerService spielerService = new SpielerService();
			spielerService.setEloPersistence(persistence);
			SpielService spielService = new SpielService();
			spielService.setEloPersistence(persistence);
			EloService eloService = new EloService();
			spielService.setEloService(eloService);
			StatistikService statistikService = new StatistikService();
			statistikService.setEloPersistence(persistence);
			TeamService teamService = new TeamService();
			teamService.setEloPersistence(persistence);
			ReportService reportService = new ReportService();
			reportService.setEloPersistence(persistence);
			reportService.setEloService(eloService);
			request.setAttribute("spielService", spielService);
			request.setAttribute("spielerService", spielerService);
			request.setAttribute("eloService", eloService);
			request.setAttribute("statistikService", statistikService);
			request.setAttribute("teamService", teamService);
			request.setAttribute("reportService", reportService);
			entityManager.getTransaction().begin();
			
//			persistence.findAll(Spieler.class, Integer.MAX_VALUE, " left join fetch m.punktzahlHistorie");
//			persistence.findAll(Team.class, Integer.MAX_VALUE, " left join fetch m.punktzahlHistorie");
//			persistence.findAll(Spiel.class);
//			persistence.findAll(EloPunktzahl.class);
			
			chain.doFilter(request, response);
			entityManager.getTransaction().commit();
		} catch (Exception e) {
			if(entityManager.getTransaction() != null && entityManager.getTransaction().isActive()) {
				entityManager.getTransaction().rollback();
			}
			throw new IOException(e);
		} finally {
			request.removeAttribute("spielService");
			request.removeAttribute("spielerService");
			request.removeAttribute("eloService");
			request.removeAttribute("statistikService");
			request.removeAttribute("teamService");
			request.removeAttribute("reportService");
			if(entityManager != null) {
				if(entityManager.getTransaction() != null && entityManager.getTransaction().isActive()) {
					entityManager.getTransaction().rollback();
				}
				entityManager.close();
			}
		}
	}