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