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

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


          網站導航:
           
          主站蜘蛛池模板: 灵寿县| 读书| 横峰县| 肥西县| 鄂托克前旗| 彭阳县| 青海省| 莎车县| 墨脱县| 江永县| 淮南市| 东城区| 凤凰县| 唐山市| 于都县| 东丰县| 贵德县| 开鲁县| 辰溪县| 曲麻莱县| 贵溪市| 祁东县| 黄陵县| 高碑店市| 余姚市| 商丘市| 中牟县| 祁东县| 南江县| 普安县| 武胜县| 遵义市| 韶山市| 瑞昌市| 寻乌县| 平泉县| 武胜县| 柘荣县| 兰坪| 剑阁县| 普陀区|