一路拾遺
          Collect By Finding All The Way ......
          posts - 81,comments - 41,trackbacks - 0
           
              public int getCount(String emailGroupId, String emailBatchId)
                      
          throws HibernateException {

                  Session session 
          = HibernateUtil.currentSession();
                  Transaction tx 
          = session.beginTransaction();

                  String hql 
          = "select count(*) from EmailSendInfo where email_group_id = :emailGroupId and batch_id = :batchId";
                  Query query 
          = session.createQuery(hql);

                  query.setString(
          "emailGroupId", emailGroupId);
                  query.setString(
          "batchId", emailBatchId);
                  
          /*
                   * for (Iterator it = query.iterate(); it.hasNext();) { return
                   * ((Integer) it.next()).intValue(); }
                   
          */

                  
          try {
                      
          return ((Integer) query.iterate().next()).intValue();
                  }
           catch (Exception e) {
                      
          throw new HibernateException("");
                  }
           finally {
                      tx.commit();
                      HibernateUtil.closeSession();
                  }

              }
          posted on 2009-07-13 10:46 胖胖泡泡 閱讀(324) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 扎赉特旗| 福鼎市| 清镇市| 山阴县| 霍林郭勒市| 奉新县| 额尔古纳市| 三穗县| 枣强县| 宝丰县| 崇州市| 白朗县| 甘德县| 壶关县| 翁牛特旗| 上栗县| 湖北省| 萨迦县| 孝义市| 阳曲县| 杭锦后旗| 双鸭山市| 乌拉特中旗| 平山县| 泾川县| 宜都市| 建昌县| 左贡县| 象州县| 信丰县| 正宁县| 卢氏县| 务川| 平舆县| 开远市| 洮南市| 平顶山市| 石棉县| 桃园市| 东辽县| 宜春市|