java - 分页和天真的查询 + eclipse 链接
问题描述
我正在尝试在 Eclipse 链接 + JPA for PostgreSQL 中编写本机查询和分页
但我遇到了例外:
这是我尝试过的代码:
@Query(nativeQuery = true, value= "select a.* from rqst a LEFT OUTER JOIN table_b b ON a.id= b.id where a.code='abc' ORDER BY /*#pagable*/")
@Query(nativeQuery = true, value= "select a.* from rqst a LEFT OUTER JOIN table_b b ON a.id= b.id where a.code='abc' ORDER BY ?#{#pageable}")
我跟着这个链接但没有运气:
带有分页的 Spring Data 和 Native Query
任何帮助表示赞赏
当我使用第二个查询时,我得到了这个异常:
Can't infer the SQL type to use for an instance of org.springframework.data.domain.PageRequest. Use setObject() with an explicit Types value to specify the type to use.
at org.postgresql.jdbc.PgPreparedStatement.setObject(PgPreparedStatement.java:1039) ~[postgresql-9.4.1208.jar:9.4.1208]
解决方案
推荐阅读
- ruby - 如何检查我的令牌是否在 Rails 上处于活动状态
- business-objects - Web Intelligence :聚合值的计数
- java - 从 Java 调用时,FFMPEG 不会产生有效的 mp4 输出
- python - Django 错误 -django.db.utils.DataError: value too long for type character varying(1)
- android - 应用被多个 Firebase 项目杀死时未收到 FCM 通知
- c# - C# 从同一命名空间中的单独类调用辅助函数,没有前缀并且可以访问 System.Web.UI.Page
- sql - 根据我想对多个值进行 CASE 的聚合行生成一个值?
- python - 在日期时间段内分配累积的第 N 天。[即这一行属于第134天]
- assembly - 为什么堆栈中地址的大小大于保存的eip地址的大小?
- javascript - 为什么事件“transitionend”会触发两次?