Skip to content

Commit fabc26b

Browse files
GH-2455 - Use the correctly, labelled root node.
Resolves #2455.
1 parent 5977a57 commit fabc26b

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,10 @@ public Node createRootNode(NodeDescription<?> nodeDescription) {
221221
*/
222222
public Statement createStatementReturningDynamicLabels(NodeDescription<?> nodeDescription) {
223223

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

226229
Condition versionCondition;
227230
if (((Neo4jPersistentEntity) nodeDescription).hasVersionProperty()) {

0 commit comments

Comments
 (0)