posts - 0,  comments - 1,  trackbacks - 0
          /**
               * TOP查詢
               * 
          @param  sql String
               * 
          @param  top int
               * 
          @return  List
               
          */
              
          public  List findTop(String sql,  int  top) {
                HibernateTemplate ht 
          =   this .getHibernateTemplate();
                ht.setMaxResults(top);
                
          return  ht.find(sql);
              }

              
          /**
               * 分頁查詢
               * 
          @param  sql String
               * 
          @param  firstRow int
               * 
          @param  maxRow int
               * 
          @return  List
               
          */
              
          public  List findPage( final  String sql, final   int  firstRow, final   int  maxRow) {
                
          return   this .getHibernateTemplate().executeFind( new  HibernateCallback(){
                      
          public  Object doInHibernate(Session session)  throws  SQLException,
                              HibernateException {
                         Query q 
          =  session.createQuery(sql);
                         q.setFirstResult(firstRow);
                         q.setMaxResults(maxRow);
                         
          return  q.list();
                         }
                  });      
              }
          posted on 2008-03-27 17:25 火焰出林 閱讀(334) 評論(0)  編輯  收藏 所屬分類: J2EE
          <2025年8月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          留言簿(1)

          隨筆分類

          文章分類(25)

          文章檔案(23)

          新聞檔案(8)

          相冊

          最新隨筆

          搜索

          •  

          最新評論

          主站蜘蛛池模板: 泰兴市| 松阳县| 姚安县| 马尔康县| 高要市| 天台县| 卢湾区| 寿阳县| 平江县| 紫云| 莱州市| 灌阳县| 宝兴县| 珠海市| 石林| 晋州市| 门源| 保亭| 大关县| 汉中市| 从江县| 嵩明县| 恩施市| 泰州市| 澳门| 嘉禾县| 昭觉县| 醴陵市| 沙河市| 晋宁县| 濉溪县| 永寿县| 淮安市| 重庆市| 凤城市| 远安县| 长顺县| 隆林| 长丰县| 拜泉县| 安远县|