Exemple #1
0
  private void createOrder2(Customer customer) {

    Product product1 = Ebean.getReference(Product.class, 1);

    Order order = new Order();
    order.setStatus(Status.SHIPPED);
    order.setCustomer(customer);

    List<OrderDetail> details = new ArrayList<>();
    details.add(new OrderDetail(product1, 4, 10.50));
    order.setDetails(details);

    order.addShipment(new OrderShipment());

    Ebean.save(order);
  }
Exemple #2
0
  private void createOrder3(Customer customer) {

    Product product1 = Ebean.getReference(Product.class, 1);
    Product product3 = Ebean.getReference(Product.class, 3);

    Order order = new Order();
    order.setStatus(Status.COMPLETE);
    order.setCustomer(customer);

    List<OrderDetail> details = new ArrayList<>();
    details.add(new OrderDetail(product1, 3, 10.50));
    details.add(new OrderDetail(product3, 40, 2.10));
    details.add(new OrderDetail(product1, 5, 10.00));
    order.setDetails(details);

    order.addShipment(new OrderShipment());

    Ebean.save(order);
  }
Exemple #3
0
  private Order createOrder1(Customer customer) {

    Product product1 = Ebean.getReference(Product.class, 1);
    Product product2 = Ebean.getReference(Product.class, 2);
    Product product3 = Ebean.getReference(Product.class, 3);

    Order order = new Order();
    order.setCustomer(customer);

    List<OrderDetail> details = new ArrayList<>();
    details.add(new OrderDetail(product1, 5, 10.50));
    details.add(new OrderDetail(product2, 3, 1.10));
    details.add(new OrderDetail(product3, 1, 2.00));
    order.setDetails(details);

    order.addShipment(new OrderShipment());

    Ebean.save(order);
    return order;
  }