一路拾遺
          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 胖胖泡泡 閱讀(323) 評(píng)論(0)  編輯  收藏

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 林周县| 龙海市| 和政县| 天全县| 土默特右旗| 江华| 贵阳市| 和静县| 措美县| 南岸区| 丁青县| 茶陵县| 乐安县| 肇源县| 湾仔区| 姚安县| 金湖县| 汉沽区| 南溪县| 南开区| 阳西县| 山阳县| 靖江市| 灵宝市| 平谷区| 浦江县| 城口县| 名山县| 鲁甸县| 农安县| 阜宁县| 周宁县| 玉山县| 孟州市| 余干县| 收藏| 西城区| 汉源县| 安化县| 正镶白旗| 闻喜县|