DATAMONGO-1617 - Reinstantiate version property initialization before BeforeConvertEvent publication.
Related pull request: #443.
This commit is contained in:
committed by
Christoph Strobl
parent
827b6204a9
commit
98a9b66e6b
@@ -833,11 +833,10 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
|
||||
|
||||
protected <T> void doInsert(String collectionName, T objectToSave, MongoWriter<T> writer) {
|
||||
|
||||
initializeVersionProperty(objectToSave);
|
||||
maybeEmitEvent(new BeforeConvertEvent<T>(objectToSave, collectionName));
|
||||
assertUpdateableIdIfNotSet(objectToSave);
|
||||
|
||||
initializeVersionProperty(objectToSave);
|
||||
|
||||
Document dbDoc = toDocument(objectToSave, writer);
|
||||
|
||||
maybeEmitEvent(new BeforeSaveEvent<T>(objectToSave, dbDoc, collectionName));
|
||||
@@ -940,8 +939,8 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
|
||||
for (T o : batchToSave) {
|
||||
|
||||
initializeVersionProperty(o);
|
||||
|
||||
maybeEmitEvent(new BeforeConvertEvent<T>(o, collectionName));
|
||||
|
||||
Document document = toDocument(o, writer);
|
||||
|
||||
maybeEmitEvent(new BeforeSaveEvent<T>(o, document, collectionName));
|
||||
|
||||
Reference in New Issue
Block a user