-
Notifications
You must be signed in to change notification settings - Fork 563
Description
Consider an entity with a lazy-loaded one-to-many association, and a simple shallow projection that excludes the association. When retrieving the entity collection with the shallow projection, we would hope and expect that the association is never loaded.
In practice, SDR forces loading of the association via the EmbeddedResourcesAssembler's getEmbeddedResources method. This can become a significant performance problem in complex entity networks with many associations and large-scale one-to-many relationships.
I am not 100% clear on the scope of responsibility of the the EmbeddedResourcesAssembler (does it assemble association links, nested response models, or both?), but it is clearly aware of the projection context via its projector member. It can use this to check if the actual value of the association is needed in the projection. If not, then the property fetch done here and the subsequent collection processing can be skipped; all that should be needed is a link to the relevant relation endpoint.