Пример #1
0
 @Override
 public void changeAddress(OrderModel order, AddressModel address) {
   em.getTransaction().begin();
   order.setDeliveryAddress(address);
   em.merge(order);
   em.getTransaction().commit();
 }
Пример #2
0
 @Override
 public void addOrderEntry(OrderModel order, OrderEntityModel orderEntity) {
   em.getTransaction().begin();
   order.getOrderEntities().add(orderEntity);
   em.persist(order);
   em.getTransaction().commit();
 }
Пример #3
0
  @Override
  public void save(OrderModel order, Long addressId) throws Exception {
    AddressModel address = em.getReference(AddressModel.class, addressId);
    Assert.assertNotNull(address.getAddress());
    Assert.assertNotNull(address.getPhone());

    order.setDeliveryAddress(address);
    em.getTransaction().begin();
    em.persist(order);
    em.getTransaction().commit();
  }