Seam 的服务器端分页模式?

发布于 2024-10-10 05:02:55 字数 602 浏览 0 评论 0 原文

我有一个基于 JBoss Seam、RichFaces 和 Hibernate/JPA 的应用程序。我创建了一个 DAO 类和几个业务层类,用于根据各种条件检索数据。 (获取最新的、浏览全部等)我想返回这些结果并向用户显示它们,允许用户对它们进行分页。但是,由于返回的对象可能相当大(并且有大量对象),我不想使用类似 < rich:datascroller/> 这需要我在一个大型查询中检索所有对象并将它们维护在内存中。

是否有任何普遍接受的模式来执行数据集的服务器端分页?我正在寻找一种策略:

  • 使用起始索引和计数检索数据的子集
  • 使用“下一个”和“上一个”按钮滚动数据集,从而使用更新的起始索引和计数检索数据的新子集

你们中是否有人见过自定义 DataModel 对象,这些对象允许我使用 但仍执行服务器操作使用子集查询进行侧分页?我非常想了解您处理这种情况的方法。

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.

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
  • Scroll through the dataset using 'next' and 'previous' buttons, thereby retrieving a new subset of the data using an updated start index and count

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挽袖吟 2024-10-17 05:02:55

Seam 应用程序框架中有一个内置的服务器端分页。只需看看 EntityQuery 对象。

您可以轻松地扩展这些类,并且在使用 getResultList() 时基本上可以免费获得分页。

但是,在开始到处扩展这些类之前,请先查看一下 此博文

There is an in-built server side pagination in Seam Application Framework. Just have a look at the EntityQuery objects.

You can easily extends those classes, and basically get pagination for free when using getResultList()

However, before you start extending those classes everywhere, take a look at this blog post.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文