Spring Data JPA仍在尝试为自定义实现生成查询方法

时间:2018-01-11 11:35:30

标签: spring-data-jpa

我目前正在使用带有Spring Data JPA 2.0.2的Kotlin 1.2和Spring Boot 2.0 M7。在这里,我试图创建一个自定义实现的存储库。我的参考是https://docs.spring.io/spring-data/jpa/docs/2.0.2.RELEASE/reference/html/#repositories.custom-implementations

这是回购

interface DailyBuildStatusRepository : BaseRepository<DailyBuildStatus, Int>, DailyBuildStatusCustomRepository {

}

这是接口片段

interface DailyBuildStatusCustomRepository {
    fun filter(product: Int?, branch: Int?,
               correction: Int?, globalSearch: String, isRegEx: Boolean,
               columnParams: Collection<DataTableColumnBean>, start: Int, length: Int): List<DailyBuildStatus>
}

这是实现类的骨架

@Repository
class DailyBuildStatusCustomRepositoryImpl : DailyBuildStatusCustomRepository {

    @Autowired
    private val em: EntityManager? = null

    override fun filter(product: Int?, branch: Int?,
                        correction: Int?, globalSearch: String, isRegEx: Boolean,
                        columnParams: Collection<DataTableColumnBean>, start: Int, length: Int): List<DailyBuildStatus> {
        //impl here
    }
}

然而,在启动时,我看到了这个

Caused by: java.lang.IllegalArgumentException: Failed to create query for method public abstract java.util.List com.nokia.srandu.oms.corrviewer.db.repo.custom.DailyBuildStatusCustomRepository.filter(java.lang.Integer,java.lang.Integer,java.lang.Integer,java.lang.String,boolean,java.util.Collection,int,int)! No property filter found for type DailyBuildStatus!
.
.
.
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property filter found for type DailyBuildStatus!

以前在Java中的Spring Data 1.11.9中工作(当然,实现类的名称根据文档的不同而不同)。也许有人知道为什么现在在Spring 2.0.2中发生这种情况?

0 个答案:

没有答案