论坛首页 入门技术论坛

在hibernate中如何按顺序排序呢?

浏览 4301 次
该帖已经被评为新手帖
作者 正文
   发表时间:2006-10-16  
在hibernate中如何按顺序排序呢? 
以前用sql语言就是select  *  from  text  order  by  id  desc  来按顺序排序,现在在hibernate中,我的代码是这样子的. 
public  Text  getText(long  id)  { 
                        
                       s  =  SessionFactory.currentSession(); 
                       Transaction  tx  =  s.beginTransaction(); 
                       Long  theId  =  new  Long(id); 
                       Text  text  =  (Text)  s.load(Text.class,  theId); 
                       tx.commit(); 
                       return  text; 
           } 
返回了text后,但在jsp网页中只是从最后的数据显示到最新的数据,不是最新的放在前面,应该如何调试.请指点.
   发表时间:2006-10-17  
你返回一个对象,怎么排序?!
0 请登录后投票
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics