在我的Spring boot项目中,我需要查询一个entity具有,和XrayVulnerabilityEntity功能的表。pagingsortingspecification
Paging并且sorting实施似乎还可以。但是当我添加时Specification,它throws an error是这样的:
导致:org.springframework.beans.factory.BeanCreationException:创建名称为“xrayVulnerabilityRepository”的bean时出错:调用init方法失败;嵌套异常是 java.lang.IllegalArgumentException:要么对除一次输入的 Pageable 和 Sort 之外的所有参数使用 @Param,要么根本不使用 @Param!
我使用的存储库:
@Repository
public interface XrayVulnerabilityRepository extends PagingAndSortingRepository<XrayVulnerabilityEntity,XrayVulnerabilityPK> , JpaSpecificationExecutor<XrayVulnerabilityEntity>{
@Query("SELECT x FROM XrayVulnerabilityEntity x,DomainArtifactEntity d WHERE d.domainOrgName=:domainOrgNameParam AND x.domainArtifactId=d")
public Page<XrayVulnerabilityEntity> findAll(@Param(value = "domainOrgNameParam") String domainOrgName,Specification<XrayVulnerabilityEntity> spec, Pageable pageable);
@Query("SELECT COUNT(x) FROM XrayVulnerabilityEntity x,DomainArtifactEntity d WHERE d.domainOrgName=:domainOrgNameParam AND x.domainArtifactId=d")
public Long getCount(@Param(value = "domainOrgNameParam") String domainOrgName,Specification<XrayVulnerabilityEntity> spec);
}
我在实施时做错了什么吗Specification?
开满天机
四季花海
犯罪嫌疑人X
相关分类