Exemple #1
0
  public int update(int oid, String quantity, String memo) { // 更新揀貨單的揀貨數量
    logger.debug(
        "OrderPlaceDDAO.update: "
            + "pickId: "
            + oid
            + ", quantity: "
            + quantity
            + ", memo: "
            + memo);

    EntityManager em = XPersistence.getManager();
    OrderPlaceD bean = em.find(OrderPlaceD.class, oid);
    logger.debug("OrderPlaceD.update: orderPlaceD: " + bean);
    if (bean != null) {
      //			bean.setQuantity(quantity);
      bean.setRemark(memo);
      try {
        em.merge(bean);
        XPersistence.commit();
      } catch (Exception e) {
        logger.error("OrderPlaceD.update: " + e);
      }
      return 1; // 1:成功
    }
    return 0; // 0:失敗
  }
 private void createDeliveryType(int number, String description) {
   DeliveryType type = new DeliveryType();
   type.setNumber(number);
   type.setDescription(description);
   XPersistence.getManager().persist(type);
   XPersistence.commit();
 }
Exemple #3
0
 public boolean insert(OrderStoreD beanD) {
   XPersistence.getManager().persist(beanD);
   XPersistence
       .commit(); // 若 UUID 重複,會有例外: org.hibernate.PersistentObjectException: detached entity
                  // passed to persist: com.kaijung.jpa.OrderStoreD
   // XHibernate.commit();
   return true;
 }
 private void deleteDeliveryType(int number) {
   DeliveryType type = XPersistence.getManager().find(DeliveryType.class, number);
   XPersistence.getManager().remove(type);
   XPersistence.commit();
 }