Setmaxresults method of Hibernate query interface: set the maximum number of returned records
•
Java
setMaxResults(int maxResults)
Example
Session session = sessionFactory.openSession(conn); //获取session对象 String hql = "from UserForm";//定义查询HQL语句 List list = null;//定义保存查询结果集的List集合对象 try{ Query query = session.createQuery(hql); //执行查询语句获取Query对象 list = query.setMaxResults(5).list(); //获取前5条记录 }catch(Exception e){ System.out.println("查询用户信息时的错误信息:"+e.getMessage()); }@H_502_12@总结
以上是编程之家为你收集整理的Hibernate Query接口 setMaxResults方法:设置最大返回记录数全部内容,希望文章能够帮你解决Hibernate Query接口 setMaxResults方法:设置最大返回记录数所遇到的程序开发问题。
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。![]()
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码