错误内容:
Could not write JSON: write javaBean error, fastjson version 1.2.41, class org.springframework.data.domain.PageImpl, write javaBean error, fastjson version 1.2.41, class com.sun.proxy.$Proxy119, fieldName : 0; nested exception is com.alibaba.fastjson.JSONException: write javaBean error, fastjson version 1.2.41, class org.springframework.data.domain.PageImpl, write javaBean error, fastjson version 1.2.41, class com.sun.proxy.$Proxy119, fieldName : 0
下面是部分代码
public interface OperationPJ {
String getId();
String getState();
}
public interface OperationRepository extends CrudRepository<Operation,String> {
Page<OperationPJ> findByCarInfoNo(String carInfoId, Pageable pageable);
}
@Service
public class OperationService {
@Autowired
private OperationRepository operationRepository;
public Page<OperationPJ> findByCarInfoNo(String carInfoNo, Pageable pageable) {
return operationRepository.findByCarInfoNo(carInfoNo, pageable);
}
}
spring data jpa projections文档
https://docs.spring.io/spring-data/jpa/docs/2.0.2.RELEASE/reference/html/#projections
2条答案
按热度按时间mbyulnm01#
能提供能重现问题的testcase么?
jgzswidk2#
这个问题解决了吗?我用的1.2.62版本依然报错,OperationPJ应该是动态代理对象