daoImpl实现的方法:
?
public News nextPage(News news){
try{
String queryString="from News d where d.id order by id desc";
Query queryObject=getSession().createQuery(queryString);
queryObject.setLong(0,news.getId());
queryObject.setFirstResult(0);
queryObject.setMaxResults(1);public News nextPage(News news) {
try {
String queryString = "from News d where d.id>
? order by id asc";
Query queryObject = getSession().createQuery(queryString);
queryObject.setLong(0,news.getId());
queryObject.setFirstResult(0);
queryObject.setMaxResults(1);
return (News)queryObject.list().get(0);
} catch (RuntimeException re) {
throw re;
}
}
return (News)queryObject.list().get(0);}catch(RuntimeException re){throw re;}}