Skip to content

Improve error messages if a repository cannot be created #2341

Closed
@spring-projects-issues

Description

@spring-projects-issues

Tera opened DATACMNS-1812 and commented

I'm trying to use Spring data JDBC with Query DSL in Kotlin. This is my repository

 

@Repository
interface AgentRepository : PagingAndSortingRepository<Agent, Int>, QuerydslPredicateExecutor<Agent> {}

I've integrated these dependencies in my Gradle build:

implementation 'org.springframework.boot:spring-boot-starter-data-jdbc:2.3.3'
implementation("com.querydsl:querydsl-core:4.4.0") 
kapt "com.querydsl:querydsl-apt:4.4.0:jpa"

As soon as I try to start my application I get this error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'agentRepository' defined in it.dove.braniac.repositories.AgentRepository defined in @EnableJdbcRepositories declared on BraniacApplication: Invocation of init method failed; nested exception is org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract long org.springframework.data.querydsl.QuerydslPredicateExecutor.count(com.querydsl.core.types.Predicate)! Reason: No property count found for type Agent!

I can't understand what I'm doing wrong and if there is an incompatibility between Spring Data JDBC and QueryDSL

 

The same issue happens if I try to change from PagingAndSortingRepository to simple CrudRepository


Affects: 2.3.4 (Neumann SR4)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions