Is there a way to maintain a database cursor using hibernate between web requests? Basically, I am trying to implement pagination, but the data that is exposed is constantly changing (i.e. new entries are added to the database). We are trying to configure it in such a way that when you perform your initial search (returning a maximum of 5000 results) and you look at the results, the same records are always displayed on one page (i.e., we do not constantly execute the query each time we click on next and previous page buttons). The way we are currently implementing this is to simply select 5,000 (at most) primary keys from the table in which we place the pages, store these keys in memory, and then simply use 20 primary keys at a time to get them data from the databaseHowever, we want to get rid of the need to store these keys in memory and would prefer a database cursor, which we just keep going back and forth and back and forth to create pages.
I tried to do this with Hibernate ScrollableResults, but found that I could not call methods like next () and previous () that threw an exception if you were using another web request / hibernation session (there is nothing surprising here). Is there a way to associate a ScrollableResults object with a session, just as you would re-bind a single database object to make it persistent? Are there any other approaches to implementing this data paging with sequential paging results without caching primary keys?
, . , OpenSessionInView , , HibernateSession , , -.
, Spring WebFlow, , . , , - Hibernate " -". , , , , -, , . (, .)
Source: https://habr.com/ru/post/1744006/More articles:Is there a free open source (GNU GPL, LGPL, etc.) Comet Video Chat? (PHP) - phphow to convert RSAParameters from .net to .pem file so that I can use it in php - c #Sequence of events in Java - javaVS2010 - добавить шаблон в новое окно проекта - visual-studio-2010Что такое "образец"? - audioOracle string change timestamp - databaseКак читать более 256 столбцов из файла excel (формат 2007) с использованием OLEDB - c#JSf Tags Not Displaying - spring-securitydotNet 4.0 Clipboard Error? - c #imap_open dies when called - phpAll Articles