Пример #1
0
  public Ticket loadFullTicket(int id) {
    Session session = createNewSession();

    Ticket ticket = (Ticket) session.get(getReferenceClass(), id);

    if (ticket == null) return null;

    Hibernate.initialize(ticket.getTicketItems());
    Hibernate.initialize(ticket.getCouponAndDiscounts());
    Hibernate.initialize(ticket.getTransactions());

    List<TicketItem> ticketItems = ticket.getTicketItems();
    if (ticketItems != null) {
      for (TicketItem ticketItem : ticketItems) {
        List<TicketItemModifierGroup> ticketItemModifierGroups =
            ticketItem.getTicketItemModifierGroups();
        Hibernate.initialize(ticketItemModifierGroups);
        if (ticketItemModifierGroups != null) {
          for (TicketItemModifierGroup ticketItemModifierGroup : ticketItemModifierGroups) {
            Hibernate.initialize(ticketItemModifierGroup.getTicketItemModifiers());
          }
        }
      }
    }

    session.close();

    return ticket;
  }
Пример #2
0
  public Ticket loadCouponsAndTransactions(int id) {
    Session session = createNewSession();

    Ticket ticket = (Ticket) session.get(getReferenceClass(), id);

    Hibernate.initialize(ticket.getCouponAndDiscounts());
    Hibernate.initialize(ticket.getTransactions());

    session.close();

    return ticket;
  }