在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网页中只是从最后的数据显示到最新的数据,不是最新的放在前面,应该如何调试.请指点.
以前用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网页中只是从最后的数据显示到最新的数据,不是最新的放在前面,应该如何调试.请指点.