I checked the information on the Internet. The reason is that when pagination is used, the query result is empty, but pagination is also set, so an error will be reported.
There are two solutions:
Scheme 1, add conditions under paging code
public static List<?> getList(Session session , String HQL , int currentPage, int pageSize){
Query q = session.createQuery(HQL);
if(currentPage != 0 && pageSize != 0 && q.list().size()!= 0)
{
int startRow = (currentPage-1)*pageSize;
q.setFirstResult(startRow);
q.setMaxResults(pageSize);
}
List<?> list = q.list();
//Return search results
return list;
}
The if condition is that when the query result is empty, there will be no pagination, so no error will be reported.
Scheme 2: add this sentence to the hibernate configuration file
<property name="jdbc.use_scrollable_resultset">false</property>
Read More:
- SSH integration error: org.hibernate.hql.internal.ast.QuerySyntaxException: User is not mapped[……]
- [Solved] hcitool Error: Set scan parameters failed: Operation not permitted
- [Solved] Mybatis uses the PageHelper paging plugin error: Could not find method on interface ibatis.executor.Executor named query.
- DRF uses paging function Error: unorderedobjectlistwarning
- How to Solve Error: IncompleteElementException: Could not find result map…
- [Solved] Castle.MicroKernel.ComponentNotFoundException: No component for supporting the service ****** was f
- Springboot connects to the database error: testWhileIdle is true, validationQuery not set
- Rsync Error: Operation not permitted [How to Solve]
- laravel Error mews/captcha is locked to version 3.2.4 and an update of this package was not requested.
- The spring project is normal locally, and the bean cannot be found error is thrown when entering the docker container
- Yarn add package loading error: operation not permitted, unlink …
- [Solved] bin/hive Startup Error: Operation category READ is not supported in state standby
- Report Duplicate keys detected: ‘0’. This may cause an update error in VUE and the solution
- Django Error: ‘set‘ object is not reversible [How to Solve]
- [Solved] NPM Install Error: EPERM: operation not permitted, mkdir xxx
- Error: env [NODE_ENV] is not set (How to Solve)
- Docker Build Error: Failed to get D-Bus connection: Operation not permitted [Solved]
- [Solved] Toad Set Error: The following files specified on the Executables tab could not be found:TNS Ping
- [Local Precompilation Error] do not set execute permissions for source files
- [INS-06006] Passwordless SSH connectivity not set up [Solved]