In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about the use of query statements in Hibernate. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Today, in the sqlserver environment to do a simple add, delete and change function, to use paging, start directly with the oracle database environment has been using a jdbc refactoring of the class processing, found that no, just think of oracle and sqlserver paging sql statement writing is very different, so intend to google, and then think, why not first look at Hibernate in the sqlserver environment is how to deal with paging (I use here is Hibernate 3.0).
First, change the show_sql of the Hibernate configuration file to true, start tomcat, and find a place to turn the page in the original function of the project. For example, when two pages are displayed on each page, the Hibernate query statement is: SELECT TOP 2 * FROM... Well, yes, it seems that Hibernate is quite clever. The * page directly uses the top statement, but when you click on the next page, when the query records should be 3-4, the Hibernate query statement is: SELECT TOP 4 * FROM. I don't understand. Is Hibernate so stupid? if I want to check the records of articles 1 million to 1 million, will he also find out all of them first?
But the result of my test is that if I want to go to the data on page 5000, it is select top 10000 * from. It was taken out like this. But if you change sql dialect to oracle, the processing uses rownum to fetch as many records as you need. Try to upgrade to Hibernate 3.3 tomorrow to see if that's the case. Is java's open source framework so obsessed with sql server? He he
I monitored the database and found that the company's php program is also handled in the same way when turning pages. I am surprised that there is also a concept of rownum in sql server2005. It seems that the code still needs to be optimized after sql server2000 to 2005.
Thank you for reading! This is the end of this article on "what is the use of query sentences in Hibernate?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.