How to love Spring Hateoas solving to simple requirements -


ok, trying hard love hateoas. spring boot rest repositories amazing. want. have 2 requirements shouldn't uncommon. how do following:

given have 2 following entities:

@entity() public class gameconsole{     @id     private string name; } @entity() public class game{     @id     private string name;     @manytoone     private gameconsole gameconsole; } 

assume have rest repositories exposing 2 entities.

1 - how generate table list names of games , names of consoles 1 request:

request - /games using whatever framework, jquery, angular, doesn't matter, populate following:

|  game console  | game      | |  ps4           | uncharted | |  xbox          | halo      | 

the problem when query /games, list of games links /games/halo/gameconsole, , not actual id of gameconsole. means have loop , query each item game console name?

2 - drop down menu

lets have webpage edit game. , want add dropdown menu , put updated game console. populate drop down, query /gameconsoles , list of consoles. again problem here id game linking /game/halo/gameconsole can't matched of items returned /gameconsoles.

how solve that?

really appreciate patience guys in case answer simple.

in context of spring data rest can work projections - see here.

using projections, can embed referenced objects rather getting link resource.


Comments