Announcement Announcement Module
Collapse
No announcement yet.
error on spring-data-jpa with querydsl and custom repository Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • error on spring-data-jpa with querydsl and custom repository

    Hi,

    I have a custom repository which extends org.springframework.data.jpa.repository.JpaReposit ory (and custom factory class and so on). This works fine.

    Now I would like to use querydsl.
    I did this with defining repository in the following way:

    public interface MyRepository extends MyGenericRepository<MyEntity, String>, QueryDslPredicateExecutor<MyEntity> { ... }

    (where MyGenericRepository extends JpaRepository)

    When I try to start the app I get exceptions like:

    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'myRepository': FactoryBean threw exception on object creation; nested exception is org.springframework.data.mapping.PropertyReference Exception: No property find found for type com.xyz.MyEntity

    When I don't use my JpaRepository extension I get no errors...

    Can anybody of you give me a hint how to solve the problem??

    TIA
    Martin

  • #2
    Hi,

    Make the following changes to your code:
    1. Extend the QuerydslPredicateExecutor interface in the MyGenericRepository interface.
    2. Extend the QueryDslJpaRepository class in your implementation of the MyGenericRepository interface.
    3. The MyRepository interface should extend only the MyGenericRepository interface.

    This should do the trick.

    Comment

    Working...
    X