File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
src/main/java/org/springframework/data/neo4j/core/mapping Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 2020import java .util .HashSet ;
2121import java .util .Map ;
2222import java .util .Objects ;
23+ import java .util .Optional ;
2324import java .util .Set ;
2425import java .util .concurrent .locks .StampedLock ;
2526
@@ -211,12 +212,15 @@ public boolean hasProcessedValue(Object value) {
211212 Neo4jPersistentEntity <?> entity = mappingContext .getRequiredPersistentEntity (typeOfValue );
212213 Neo4jPersistentProperty idProperty = entity .getIdProperty ();
213214 Object id = idProperty == null ? null : entity .getPropertyAccessor (value ).getProperty (idProperty );
214- processed = id != null && processedObjects .stream ()
215+ Optional < Object > alreadyProcessedObject = id == null ? Optional . empty () : processedObjects .stream ()
215216 .filter (typeOfValue ::isInstance )
216- .anyMatch (processedObject -> id .equals (entity .getPropertyAccessor (processedObject ).getProperty (idProperty )));
217- if (processed ) { // Skip the show the next time around.
217+ .filter (processedObject -> id .equals (entity .getPropertyAccessor (processedObject ).getProperty (idProperty )))
218+ .findAny ();
219+ if (alreadyProcessedObject .isPresent ()) { // Skip the show the next time around.
220+ processed = true ;
221+ Long internalId = this .getInternalId (alreadyProcessedObject .get ());
218222 stamp = lock .tryConvertToWriteLock (stamp );
219- doMarkValueAsProcessed (valueToCheck , null );
223+ doMarkValueAsProcessed (valueToCheck , internalId );
220224 }
221225 }
222226 return processed ;
You can’t perform that action at this time.
0 commit comments