Open yangyaofei opened 4 days ago
I dig into the code, I found in DefaultNeo4jEntityConverter, In getLabels
and map
function, I think SDN use labels to get the type of node and relationship, but relationship don't have a label
, it has type.
So, the getLabels
function cannot get type information with relationship (always get BaseRelationship
), and this cause this bug I think.
I think, it should add few code in getLabels
like this line:
https://github.com/spring-projects/spring-data-neo4j/blob/f10c95f8fbb1428a60e0e254b10da94474653994/src/main/java/org/springframework/data/neo4j/core/mapping/DefaultNeo4jEntityConverter.java#L440
add code below can solve this bug:
else if (queryResult instanceof Relationship) {
Relationship relationshipRepresentation = (Relationship) queryResult;
labels.add(relationshipRepresentation.type());
}
If I have a BaseNode with Map type relationships defined with a base class
And I have two real class for relationship:
If there is a BaseNode with both two relationships :
Since SDN in node can get right instance, I think the relationship will get right, but the code below, the relationships will get same type of instance, both the
Relationship
orAnotherRelationship
, cannot Get Proper type.