更新时间:2022-08-14 19:20:27
1
2
|
Pageable pageable = this .getPageable(queryDto);
Page<PrpdExch> page2 = prpdExchDao.findAll(pageable); |
通过postman查询结果:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
{ "resultCode" : "0000" ,
"resultMsg" : "成功" ,
"transactionID" : "" ,
"resultObj" : {
"content" : [
null ,
null ,
null ,
null ,
null
],
"totalCount" : 21 ,
"pages" : 5
}
} |
最后定位到:
在类上的@IdClass注解引用的是本身,也就是说又把自己所有字段当成了主键,所以里面有字段为null就导致报错。
以前:
1
2
3
4
5
6
|
@Entity @Table (name = "prpdExch" )
@IdClass (PrpdExch. class )
public class PrpdExch implements BaseEntity, Serializable {
... } |
更改后
1
2
3
4
5
6
|
@Entity @Table (name = "prpdExch" )
@IdClass (PrpdExchKey. class )
public class PrpdExch implements BaseEntity, Serializable {
... } |
马虎出错的....
参考地址:
http://blog.csdn.net/zw0283/article/details/46009187
本文转自gaofeng36599 51CTO博客,原文链接:http://blog.51cto.com/786678398/1957138