-
Type:
Improvement
-
Status: Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 2.4 GA (Gosling)
-
Fix Version/s: None
-
Component/s: Repositories
-
Labels:None
Normally SDR creates a separate URI for a one-to-many relation. This is quite right, when the relation itself provides useful additional properties.
But this comes at a cost:
To query a list of resources with related resources, you have to do additional n queries to get the related resources as well. Now if you like to use some kind of caching for the many side of the relation, this is not possible.
Of course you can work with projections. The downside of this is that you have to use different entities in list and detail queries. Which makes things like e.g. inline editing quite hard.
The corresponding class is IMHO the LinkCollectingAssociationHandler, which is manually instanciated inside the PersistentEntityJackson2Module. Making a adjustment quite hard.
Also it differs from POST / PUT where you put the URI to the other resource directly into the links section.
It would be a great improvement to have a possibility to switch between having the relationship link pointing to its own URI or pointing to a root resource URI.
Whats your opinion?
Here some links I discovered:
http://stackoverflow.com/questions/15886897/how-do-i-avoid-n1-queries-with-spring-data-rest
http://stackoverflow.com/questions/24570279/canonical-links-with-spring-hateoas
http://stackoverflow.com/questions/25143193/hateoas-restfull-entity-relation-broken
Thanks,
Thomas