@Override
 public void syncTypeAccountData() {
   Connection db2Conn = null;
   SyncTypeAcc sync = new SyncTypeAcc();
   Statement stmt = null;
   Session session = sessionFactory.openSession();
   Transaction tx = session.beginTransaction();
   String HOST_SIBS = setting.findValueByName("HOST_SIBS");
   String HOST_NAME = setting.findValueByName("HOSTUSER");
   String HOST_PASS = setting.findValueByName("HOSTPASS");
   String HOST_LIB = setting.findValueByName("HOSTLIBTYPE");
   try {
     db2Conn = ConnectDbAS400.Db2connect(HOST_SIBS, HOST_NAME, HOST_PASS);
     stmt = db2Conn.createStatement();
     ResultSet rs;
     String sqlconn =
         "select d.sccode, d.dp2cur, d.pscdes, d.pactyp, d.psldes from "
             + HOST_LIB
             + ".DDPAR2 d where d.PACTYP='D' and d.DP2CUR = 'VND' ";
     rs = stmt.executeQuery(sqlconn);
     int index = 0;
     deleteAll(SyncTypeAcc.class);
     while (rs.next()) {
       index = index + 1;
       System.out.println("Index: " + index + " - Code: " + rs.getString("sccode").trim());
       sync =
           new SyncTypeAcc(
               rs.getString("sccode").trim(),
               rs.getString("dp2cur").trim(),
               rs.getString("pscdes").trim(),
               rs.getString("pactyp").trim(),
               rs.getString("psldes").trim());
       session.save(sync);
       if (index % 100 == 0) {
         session.flush();
         session.clear();
       }
     }
     tx.commit();
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     try {
       db2Conn.close();
       stmt.close();
       session.close();
     } catch (SQLException e) {
       e.printStackTrace();
     }
   }
 }
  @Override
  public double syncDDMemoAccount(String accNo) {
    Connection db2Conn = null;
    Statement stmt = null;
    Session session = sessionFactory.openSession();
    Transaction tx = session.beginTransaction();
    String HOST_SIBS = setting.findValueByName("HOST_SIBS");
    String HOST_NAME = setting.findValueByName("HOSTUSER");
    String HOST_PASS = setting.findValueByName("HOSTPASS");
    String HOST_LIB = setting.findValueByName("HOSTLIB");
    double ddamt = 0;

    try {
      List<AccCustomer> acCust = new ArrayList<AccCustomer>();
      db2Conn = ConnectDbAS400.Db2connect(HOST_SIBS, HOST_NAME, HOST_PASS);
      stmt = db2Conn.createStatement();
      ResultSet rs;
      String sqlconn =
          "select cbal,ACCTNO  from " + HOST_LIB + ".DDMEMO d where ACCTNO = " + accNo + " ";
      rs = stmt.executeQuery(sqlconn);
      int index = 0;
      while (rs.next()) {
        index = index + 1;
        acCust = cusDao.findList("from AccCustomer where dracct='" + accNo + "'");
        for (AccCustomer ac : acCust) {
          ddamt = rs.getDouble("cbal");
          ac.setDdamt(ddamt);
          cusDao.update(ac);
        }
      }
      tx.commit();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      try {
        db2Conn.close();
        stmt.close();
        session.close();
      } catch (SQLException e) {
        e.printStackTrace();
      }
    }
    return ddamt;
  }