如何在MySQL中使用hibernate从表中获取行? [英] How to fetch rows from middle of the table in mysql using hibernate?

查看:87
本文介绍了如何在MySQL中使用hibernate从表中获取行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在UI上显示数据库表中的行。所以,可以说我们在表格中有200行。所以,我的第一击会给我前20行。现在,我想在下一次击中获取下20行。我使用Hibernate来处理数据库的CRUD操作。



query.setMaxResults(int size)对于第一次打击可以正常工作。但是如何处理第二次和以后的事务? / p>

解决方案

查询


  • 可以通过调用setMaxResults(),setFirstResult()来选择结果集。


请参阅 http://docs.jboss.org/hibernate/orm/3.6/javadocs/org/hibernate/ Query.html


I have to display rows from the database table on the UI. So, lets say we have 200 rows in the table. So , my first hit will give me first 20 rows. Now, i want to fetch next 20 rows in the next hit. I am using Hibernate for handling database CRUD operations.

query.setMaxResults(int size) works fine for first hit .But how to handle transactions for 2nd and onwards hits ?

解决方案

Query

  • a particular page of the result set may be selected by calling setMaxResults(), setFirstResult().

see http://docs.jboss.org/hibernate/orm/3.6/javadocs/org/hibernate/Query.html

这篇关于如何在MySQL中使用hibernate从表中获取行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆