Skip to content

Commit bc71339

Browse files
committed
Fix virtual node id working (#743)
1 parent 51d13ee commit bc71339

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

common/src/main/java/apoc/result/VirtualNode.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public VirtualNode(Label[] labels, Map<String, Object> props) {
4747
this.id = MIN_ID.decrementAndGet();
4848
addLabels(asList(labels));
4949
this.props.putAll(props);
50-
this.elementId = null;
50+
this.elementId = UUID.randomUUID().toString();
5151
}
5252

5353
@SuppressWarnings("unused") // used from extended
@@ -68,11 +68,13 @@ public VirtualNode(Node node, List<String> propertyNames, boolean wrapNodeIDs) {
6868
final long id = node.getId();
6969
// if node is already virtual, we return the same id
7070
this.id = id < 0 || wrapNodeIDs ? id : MIN_ID.decrementAndGet();
71+
this.elementId = id < 0 || wrapNodeIDs
72+
? node.getElementId()
73+
: UUID.randomUUID().toString();
7174
// to not overlap this nodes ids with ids from VirtualNode(Label[] labels, Map<String, Object> props)
7275
this.labels.addAll(Util.labelStrings(node));
7376
String[] keys = propertyNames.toArray(new String[propertyNames.size()]);
7477
this.props.putAll(node.getProperties(keys));
75-
this.elementId = node.getElementId();
7678
}
7779

7880
public VirtualNode(Node node, List<String> propertyNames) {

0 commit comments

Comments
 (0)