public HashMap<Integer, Integer[]> countOfPassengerOnEveryStation(Train train) {
        log.debug("Start countOfPassengerOnEveryStation select");
        List stationFrom = em.createQuery("select station.id, count(ticket.id), 0, schedule.seqNumber - 1 \n" +
                "from Train train \n" +
                "left join train.ticketsById ticket\n" +
                "inner join ticket.stationByStationFrom station\n" +
                "inner join train.routeByIdRoute route\n" +
                "inner join route.schedulesById schedule\n" +
                "inner join schedule.wayByIdWay way\n" +
                "inner join way.stationByIdStation1 stationFrom\n" +
                "where train.name = ?\n" +
                "and stationFrom.id = station.id\n" +
                " group by station.id")
                .setParameter(1, train.getName())
                .getResultList();
        List stationTo = em.createQuery("select station.id, 0, count(ticket.id), schedule.seqNumber \n" +
                "from Train train \n" +
                "left join train.ticketsById ticket\n" +
                "inner join ticket.stationByStationTo station\n" +
                "inner join train.routeByIdRoute route\n" +
                "inner join route.schedulesById schedule\n" +
                "inner join schedule.wayByIdWay way\n" +
                "inner join way.stationByIdStation2 stationTo\n" +
                "where train.name = ?\n" +
                "and stationTo.id = station.id\n" +
                " group by station.id")
                .setParameter(1, train.getName())
                .getResultList();
        HashMap<Integer, Integer[]> result = new HashMap<Integer, Integer[]>();
        for (Object[] obj : (List<Object[]>) stationFrom) {
            if (result.containsKey(obj[0])) {
                Integer[] a = result.get(obj[0]);
                a[0] += ((Long) obj[1]).intValue();
                a[1] += (Integer) obj[2];
                result.put((Integer) obj[0], new Integer[]{a[1], a[2], (Integer) obj[3]});
            } else {
                result.put((Integer) obj[0], new Integer[]{((Long) obj[1]).intValue(), (Integer) obj[2], (Integer) obj[3]});
            }
        }
        for (Object[] obj : (List<Object[]>) stationTo) {
            if (result.containsKey(obj[0])) {
                Integer[] a = result.get(obj[0]);
                a[0] += (Integer) obj[1];
                a[1] += ((Long) obj[2]).intValue();
                result.put((Integer) obj[0], new Integer[]{a[1], a[2], (Integer) obj[3]});
            } else {
                result.put((Integer) obj[0], new Integer[]{(Integer) obj[1], ((Long) obj[2]).intValue(), (Integer) obj[3]});
            }
        }
        return result;
    }