/**
* 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();
}
});
}
只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。 | ||
![]() |
||
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
|
||
相關(guān)文章:
|
||
| |||||||||
日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
---|---|---|---|---|---|---|---|---|---|
25 | 26 | 27 | 28 | 29 | 30 | 31 | |||
1 | 2 | 3 | 4 | 5 | 6 | 7 | |||
8 | 9 | 10 | 11 | 12 | 13 | 14 | |||
15 | 16 | 17 | 18 | 19 | 20 | 21 | |||
22 | 23 | 24 | 25 | 26 | 27 | 28 | |||
29 | 30 | 1 | 2 | 3 | 4 | 5 |
留言簿(1)
隨筆分類
文章分類(25)
- C/C++
- Core JAVA(4)
- J2EE(16)
- 學(xué)習(xí)方法談(1)
- 學(xué)習(xí)日記
- 程序人經(jīng)驗(yàn)談(3)
- 計(jì)算機(jī)基礎(chǔ)(1)
文章檔案(23)
新聞檔案(8)
相冊(cè)
最新隨筆
搜索
最新評(píng)論

- 1.?re: Java Reflection (JAVA反射)
- 高手,好強(qiáng)大.崇拜啊.
- --高手在唱歌