コード例 #1
0
  /* (non-Javadoc)
   * @see org.apache.ibatis.jgamestore.service.impl.IOrderService#insertOrder(org.apache.ibatis.jgamestore.domain.Order)
   */
  public void insertOrder(Order order) {
    try {
      // Get the next id within a separate transaction
      order.setOrderId(getNextId("ordernum"));

      daoManager.startTransaction();

      itemDao.updateAllQuantitiesFromOrder(order);
      orderDao.insertOrder(order);

      daoManager.commitTransaction();
    } finally {
      daoManager.endTransaction();
    }
  }
コード例 #2
0
  /* (non-Javadoc)
   * @see org.apache.ibatis.jgamestore.service.impl.IOrderService#getOrder(int)
   */
  public Order getOrder(int orderId) {
    Order order = null;

    try {
      daoManager.startTransaction();

      order = orderDao.getOrder(orderId);

      for (int i = 0; i < order.getLineItems().size(); i++) {
        LineItem lineItem = (LineItem) order.getLineItems().get(i);
        lineItem.setItem(itemDao.getItem(lineItem.getItemId()));
      }

      daoManager.commitTransaction();
    } finally {
      daoManager.endTransaction();
    }

    return order;
  }
コード例 #3
0
 /* (non-Javadoc)
  * @see org.apache.ibatis.jgamestore.service.impl.IOrderService#getOrdersByUsername(java.lang.String)
  */
 public PaginatedList getOrdersByUsername(String username) {
   return orderDao.getOrdersByUsername(username);
 }