spring-projects / spring-projects/spring-data-rest

Allow multiple repositories per entity (only one should be exported) [DATAREST-923]

Open
#1,286 43 comments 15 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

has: votes-jira in: repository type: enhancement
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Tim Meißner opened DATAREST-923 and commented

My case is that i have an Entity "User" and two Repositories:

  • UserRepository extends CrudRepository, @RepositoryRestResource(exported = false): meant for internal usage by services etc.
  • UserRestRepository extends Repository, @RepositoryRestResource(exported = true): meant for external usage, restricted access, etc.

This exports a user resource in 50% of the times i start up the application. I tried to work around this by annotating them with @Order(0/1) for the UserRepository and @Order(1/0) for the UserRestRepository, but it doesn't work.

So I would like to have the possibility to have multiple Repositories for one entity (only one exported but it should not conflict with other normal Repositories that are not exported).


Affects: 2.5.4 (Hopper SR4)

Reference URL: http://stackoverflow.com/questions/36112451/multiple-repositories-for-the-same-entity-in-spring-data-rest

Issue Links:

  • DATACMNS-1448 Repositories should select primary repository in case multiple are available for a domain type
    ("depends on")

Referenced from: pull request https://github.com/spring-projects/spring-data-commons/pull/465, and commits https://github.com/spring-projects/spring-data-commons/commit/de7a7caa49308e6687f60d0909794df9d921b420, https://github.com/spring-projects/spring-data-commons/commit/d8705c1cca3908284abd15d972152d9720f59fee

40 votes, 40 watchers

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.