Skip to content

Commit cd34ee3

Browse files
GH-2455 - Use the correctly, labelled root node.
Resolves #2455.
1 parent 0280168 commit cd34ee3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/org/springframework/data/neo4j/core/mapping/CypherGenerator.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,10 @@ public Node createRootNode(NodeDescription<?> nodeDescription) {
223223
*/
224224
public Statement createStatementReturningDynamicLabels(NodeDescription<?> nodeDescription) {
225225

226-
final Node rootNode = Cypher.anyNode(Constants.NAME_OF_ROOT_NODE);
226+
String primaryLabel = nodeDescription.getPrimaryLabel();
227+
List<String> additionalLabels = nodeDescription.getAdditionalLabels();
228+
229+
Node rootNode = node(primaryLabel, additionalLabels).named(Constants.NAME_OF_ROOT_NODE);
227230

228231
Condition versionCondition;
229232
if (((Neo4jPersistentEntity) nodeDescription).hasVersionProperty()) {

0 commit comments

Comments
 (0)