public SoPhongVanBanNoiBo updateImpl(
      com.sgs.portlet.sovanbannoibo.model.SoPhongVanBanNoiBo soPhongVanBanNoiBo, boolean merge)
      throws SystemException {
    Session session = null;

    try {
      session = openSession();

      if (merge) {
        session.merge(soPhongVanBanNoiBo);
      } else {
        if (soPhongVanBanNoiBo.isNew()) {
          session.save(soPhongVanBanNoiBo);
        }
      }

      session.flush();

      soPhongVanBanNoiBo.setNew(false);

      return soPhongVanBanNoiBo;
    } catch (Exception e) {
      throw processException(e);
    } finally {
      closeSession(session);

      FinderCacheUtil.clearCache(SoPhongVanBanNoiBo.class.getName());
    }
  }
  public SoPhongVanBanNoiBo create(SoPhongVanBanNoiBoPK soPhongVanBanNoiBoPK) {
    SoPhongVanBanNoiBo soPhongVanBanNoiBo = new SoPhongVanBanNoiBoImpl();

    soPhongVanBanNoiBo.setNew(true);
    soPhongVanBanNoiBo.setPrimaryKey(soPhongVanBanNoiBoPK);

    return soPhongVanBanNoiBo;
  }