DATAREST-847 - RepositoryEntityCotroller.saveAndReturn(…) now uses save result.
Previously we handed the original entity to the AfterSaveEvent. This should work in most cases but actually repositories are allowed to return a completely different instance so that we now hand over the instance returned by the repository interaction to avoid potentially occurring issues.
This commit is contained in:
@@ -471,7 +471,7 @@ class RepositoryEntityController extends AbstractRepositoryRestController implem
|
|||||||
|
|
||||||
publisher.publishEvent(new BeforeSaveEvent(domainObject));
|
publisher.publishEvent(new BeforeSaveEvent(domainObject));
|
||||||
Object obj = invoker.invokeSave(domainObject);
|
Object obj = invoker.invokeSave(domainObject);
|
||||||
publisher.publishEvent(new AfterSaveEvent(domainObject));
|
publisher.publishEvent(new AfterSaveEvent(obj));
|
||||||
|
|
||||||
PersistentEntityResource resource = assembler.toFullResource(obj);
|
PersistentEntityResource resource = assembler.toFullResource(obj);
|
||||||
HttpHeaders headers = headersPreparer.prepareHeaders(resource);
|
HttpHeaders headers = headersPreparer.prepareHeaders(resource);
|
||||||
|
|||||||
Reference in New Issue
Block a user