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:
Oliver Gierke
2016-06-25 14:44:27 +02:00
parent 56ac72a262
commit 3be006ba2f

View File

@@ -471,7 +471,7 @@ class RepositoryEntityController extends AbstractRepositoryRestController implem
publisher.publishEvent(new BeforeSaveEvent(domainObject));
Object obj = invoker.invokeSave(domainObject);
publisher.publishEvent(new AfterSaveEvent(domainObject));
publisher.publishEvent(new AfterSaveEvent(obj));
PersistentEntityResource resource = assembler.toFullResource(obj);
HttpHeaders headers = headersPreparer.prepareHeaders(resource);