Reputation: 41290
Instead of creating one specialization of a CrudRepository, can multiple Spring Data JPA CrudRepository
in single interface
AND
Still have @NamedQueries
be referenced from the interface?
At the moment, I am creating a separate facade class that would collect all the repositories and expose a more unified API, but it's mostly forwarding.
Upvotes: 0
Views: 385
Reputation: 36133
That's not how Spring Data JPA repository works:
4.3. Defining Repository Interfaces
First, define a domain class-specific repository interface.
The interface must extend Repository and be typed to the domain class and an ID type. If you want to expose CRUD methods for that domain type, extend CrudRepository instead of Repository
Source: https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.definition
If you don't like this approach you can go ahead and implement your own generic Repository.
How this can be done you can see in the default implementation SimpleJpaRepository:
Upvotes: 1