Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize Hibernate Struts pagination

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "how to achieve Hibernate Struts pagination". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

First, there are two structures in Hibernate Struts pagination:

1. In Action, all the records are queried by DAO, then added to the session or request object, passed to the client, and paged by JSP. This method is very convenient when the amount of data is small, and does not affect the speed.

two。 In Action, only one page of records are queried through DAO at a time, and then passed to the JSP page.

This structure is good for programs with a large amount of data, but for a small amount of data, it will increase the request to the server and increase the load on the server.

2. Hibernate query

Since the fixed-point quantitative query method for the database is directly provided in Hibernate, I use the second method.

Such as:

Take out 100 records from Article 10, 000.

Query Q = session.createQuery ("from Cat as c"); q.setFirstResult (10000); q.setMaxResults (10000); List l = q.list (); so much for "how to implement Hibernate Struts pagination". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report