2

Assume the following scenario: a Cook entity with a name and a list of dishes. The Dish entity just has a name. The Dish entity does not know of its Cook (unidirectional relationship of one Cook to many Dishes).

In our API, we would like to get cooks, then get a cook, then get his dishes, then add a new dish for that cook. We don't want to allow for dishes to be created or listed individually, they should always be listed or posted under a specific cook. We also want all the endpoint functionality (paging/sorting/etc) in the nested dishes repository that we would normally have in the dish repository if it were a top-level repository (like cook's repository).

When implementing this using Spring Data Rest, should I look into writing my own controller for creating dishes under cooks? I have tried not exporting the dish repository but that takes you off a whole different route (embeds all the dishes when a cook gotten and does not have the usual paging and sorting functionality).

Alejandro
  • 125
  • 1
  • 7
  • similar question here http://stackoverflow.com/questions/24775583/paginate-sub-resources-in-spring-data-rest-2-1 – Hui Wang Jul 07 '16 at 06:49

0 Answers0