Example #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:失敗
  }
Example #2
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;
 }