@@ -750,7 +750,7 @@ public long count(final Query query, String collectionName) {
750
750
public long count (Query query , Class <?> entityClass , String collectionName ) {
751
751
752
752
Assert .hasText (collectionName , "Collection name must not be null or empty!" );
753
-
753
+
754
754
final DBObject dbObject = query == null ? null
755
755
: queryMapper .getMappedObject (query .getQueryObject (),
756
756
entityClass == null ? null : mappingContext .getPersistentEntity (entityClass ));
@@ -829,11 +829,10 @@ private WriteConcern potentiallyForceAcknowledgedWrite(WriteConcern wc) {
829
829
830
830
protected <T > void doInsert (String collectionName , T objectToSave , MongoWriter <T > writer ) {
831
831
832
+ initializeVersionProperty (objectToSave );
832
833
maybeEmitEvent (new BeforeConvertEvent <T >(objectToSave , collectionName ));
833
834
assertUpdateableIdIfNotSet (objectToSave );
834
835
835
- initializeVersionProperty (objectToSave );
836
-
837
836
DBObject dbDoc = toDbObject (objectToSave , writer );
838
837
839
838
maybeEmitEvent (new BeforeSaveEvent <T >(objectToSave , dbDoc , collectionName ));
@@ -923,12 +922,13 @@ protected <T> void doInsertBatch(String collectionName, Collection<? extends T>
923
922
Assert .notNull (writer , "MongoWriter must not be null!" );
924
923
925
924
List <DBObject > dbObjectList = new ArrayList <DBObject >();
925
+
926
926
for (T o : batchToSave ) {
927
927
928
928
initializeVersionProperty (o );
929
- BasicDBObject dbDoc = new BasicDBObject ();
930
-
931
929
maybeEmitEvent (new BeforeConvertEvent <T >(o , collectionName ));
930
+
931
+ BasicDBObject dbDoc = new BasicDBObject ();
932
932
writer .write (o , dbDoc );
933
933
934
934
maybeEmitEvent (new BeforeSaveEvent <T >(o , dbDoc , collectionName ));
0 commit comments