【发布时间】:2018-05-21 12:47:17
【问题描述】:
我正在开发一个需要使用pagination 显示一些屏幕的应用程序。我从 Spring Data JPA 的 PaginationAndSortingRepository 开始。一切似乎都工作正常,但是当我执行代码时我无法获取数据,它在 Eclipse 控制台上返回空而没有任何错误。
以下是我的控制器代码:-
@RequestMapping(value="/monatsultimodata" , method=RequestMethod.Get)
public List<Monatsultimo> getData(Pageable pageable){
List<Monatsultimo> dataList = null ;
try{
dataList= monatsultimoservice.getData(pageable)
}catch(Exception e){
e.printStackTrace();
}
return dataList;
}
以下是我的服务代码:-
public List<Monatsultimo> getData(Pageable pageable){
List<Monatsultimo> tableData = new AarrayList();
monatsultimorepo.findAll(pageable)
return tableData;
}
以下是我的存储库代码:-
@Repository
public interface MonatsultimoRepo extends
PagingAndSortingRepository<MonatSultimo, Integer>{
}
下面是我的 application.yaml 文件
jpa:
properties:
hibernate:
format_sql: true
show_sql: true
type: 'debug'
use_sql_comments: true
ddl-auto:update
server:
port: 9000
security:
basic:
enabled: false
我用来访问 Rest 服务的 URL - localhost:9000/Add to dictionary?page=0&size=25
一切正常,直到它返回时没有数据。请帮助我,这几天我一直在努力。
提前谢谢..
【问题讨论】:
-
查看您的服务代码..
-
在 stack-overflow 上提出此类问题之前..查看您的代码..
标签: java spring-boot spring-data-jpa