首页 > 解决方案 > 调用 findAll(pageable) 时未找到类型 [Type] 的属性 [propertyName]

问题描述

@Entity
@Table(name = "report_type")
public class ReportType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private String id;

    @NotNull
    @Column(name = "report_name")
    private String reportName;

    @NotNull
    @Column(name = "active")
    private boolean active;

    @NotNull
    @Column(name = "report_id")
    private String reportId;
}

ReportTypeService.java包含:

public Page<ReportType> findAll(Pageable pageable) {
   return reportTypeRepository.findAll(pageable);
}

我得到的错误是

service.ReportTypeService.findAll() with cause = 'NULL' and exception = 'No property report found for type ReportType! Did you mean 'reportId'?'

org.springframework.data.mapping.PropertyReferenceException: No property report found for type ReportType! Did you mean 'reportId'?

从错误消息中,我的理解是 Spring boot 正在寻找字段report,但它不存在,但我没有通过任何东西pageable,任何人都可以帮忙吗?

标签: spring-bootjpaspring-data-jpaspring-dataspring-boot-jpa

解决方案


推荐阅读