Nhibernate 分页

public IList<Student> GetStudentByPage(int pageSize, int pageIndex, string SName)
{
ISession session = NHibernateHelper.GetCurrentSession();
ITransaction trans = session.BeginTransaction();
//HQL查询
IList<Student> studentList = new List<Student>();
//string sql = "from Student";
//studentList = session.CreateQuery(sql)
// .SetFirstResult((pageIndex - 1) * pageSize)
// .SetMaxResults(pageSize)
// .List<Student>(); //SQL查询 //studentList = session.CreateSQLQuery("SELECT * FROM Student")
// .SetFirstResult((pageIndex - 1) * pageSize)
// .SetMaxResults(pageSize)
// .SetResultTransformer(Transformers.AliasToBean<Student>()).List<Student>();
return studentList;
}
上一篇:Linux命令-文件文本操作grep


下一篇:微服务框架-Spring Cloud