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

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


          網站導航:
           
          主站蜘蛛池模板: 商城县| 都昌县| 上饶市| 江门市| 新营市| 新昌县| 湖南省| 阿克苏市| 宜兴市| 阿尔山市| 宁津县| 内黄县| 廉江市| 清流县| 阳原县| 赤水市| 元氏县| 井研县| 海城市| 达尔| 濮阳市| 托克托县| 曲麻莱县| 吴川市| 外汇| 聊城市| 精河县| 屏南县| 景洪市| 根河市| 东至县| 无棣县| 云南省| 和田县| 磴口县| 赤峰市| 固阳县| 台中市| 红桥区| 千阳县| 山丹县|