I have an application based on JBoss Seam, RichFaces, and Hibernate/JPA. I've created a DAO class and a couple of business-layer classes that are used to retrieve data based on various criteria. (Fetch most recent, browse all, etc.) I'd like to return these results and display them for the user, allowing the user to paginate through them. However, since the objects returned can be rather large (and there is a large number of objects) I'd prefer not to use something like <rich:dataList />
and <rich:datascroller />
which would require me to retrieve all the objects in one large query and maintain them in memory.
我有一个基于JBoss Seam、RichFaces和Hibernate/JPA的应用程序。我创建了一个DAO类和两个业务层类,它们用于基于各种标准检索数据。(获取最新的、浏览所有等)我想返回这些结果并显示给用户,允许用户对它们进行分页。但是,由于返回的对象相当大(而且有大量的对象),所以我不希望使用像
和
Are there any generally-accepted patterns for performing server-side pagination of datasets? I'm looking for a strategy for:
对于执行数据集的服务器端分页,是否存在通用的模式?我在寻找一个策略:
- Retrieving a subset of my data using a start index and count
- 使用start索引和count检索数据的子集
- Scroll through the dataset using 'next' and 'previous' buttons, thereby retrieving a new subset of the data using an updated start index and count
- 使用“next”和“previous”按钮滚动数据集,从而使用更新的开始索引和计数检索数据的新子集
Have any of you seen custom DataModel objects that would allow me to use <rich:dataList />
and <rich:datascroller />
but still perform server-side pagination using subset queries? I'd be very curious to learn of your methodologies for handling such a scenario.
您是否见过自定义DataModel对象,它允许我使用
和
1 个解决方案
#1
3
There is an in-built server side pagination in Seam Application Framework. Just have a look at the EntityQuery objects.
Seam应用框架中有一个内置的服务器端分页。看看EntityQuery对象。
You can easily extends those classes, and basically get pagination for free when using getResultList()
您可以轻松地扩展这些类,并在使用getResultList()时免费获得分页
However, before you start extending those classes everywhere, take a look at this blog post.
但是,在您开始扩展这些类之前,先看看这篇博文。
#1
3
There is an in-built server side pagination in Seam Application Framework. Just have a look at the EntityQuery objects.
Seam应用框架中有一个内置的服务器端分页。看看EntityQuery对象。
You can easily extends those classes, and basically get pagination for free when using getResultList()
您可以轻松地扩展这些类,并在使用getResultList()时免费获得分页
However, before you start extending those classes everywhere, take a look at this blog post.
但是,在您开始扩展这些类之前,先看看这篇博文。