spring-projects / spring-data-neo4j

Provide support to increase developer productivity in Java when using Neo4j. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
http://spring.io/projects/spring-data-neo4j
Apache License 2.0
825 stars 619 forks source link

Second-level relationship fetching via @RelationshipProperties breaks [DATAGRAPH-1434] #1996

Closed spring-projects-issues closed 3 years ago

spring-projects-issues commented 3 years ago

Florent Biville opened DATAGRAPH-1434 and commented

This was reported on Neo4j-Users Slack by Harold Andres Agudelo Ramirez.

You can easily reproduce the issue by running:

cd $(mktemp -d)
git clone https://github.com/fbiville/nested-relation-query-sdn6
mvn --file nested-relation-query-sdn6/pom.xml test

The (slightly reformatted) logged query is:

MATCH (n:`Changeset`:`Hypercube`)
WHERE (n.ID = $id AND n.CANCELED = false)
RETURN n{.CANCELED, .ID, .STATE, .USER, .internalID, __nodeLabels__: labels(n), __internalNeo4jId__: id(n), 
Changeset_CHANGESET_IN_Workspace: [
    (n)-[__relationship__:`CHANGESET_IN`]->(n_changesetIns:`Workspace`:`Hypercube`) | n_changesetIns{.CANCELED, .ID, .STATE, .internalID, __nodeLabels__: labels(n_changesetIns), __internalNeo4jId__: id(n_changesetIns), 
        Workspace_WORKSPACE_IN_Work: [
            (n_changesetIns)-[__relationship__:`WORKSPACE_IN`]->(n_changesetIns_workspaceIns:`Work`:`Hypercube`) | n_changesetIns_workspaceIns{.CANCELED, .ID, .STATE, .internalID, __nodeLabels__: labels(n_changesetIns_workspaceIns), __internalNeo4jId__: id(n_changesetIns_workspaceIns), __relationship__}
        ], __relationship__}
    ]
}

The WORKSPACE_IN relationships end up not being loaded. The possible culprit could be that the __relationship__ variable is being overconstrained in the nested comprehension


Affects: 6.0.1 (2020.0.1)

Backported to: 6.0.2 (2020.0.2)

spring-projects-issues commented 3 years ago

Gerrit Meier commented

Thanks for raising this. Also the assumption about the multiple _relationship__ definition was right on spot. You could give it a try with https://github.com/spring-projects/spring-data-neo4j/tree/issue/DATAGRAPH-1434 Related PR https://github.com/spring-projects/spring-data-neo4j/pull/559