Correct that Dynamic Labels are missing in nodes created by a relationship? (Not sure that I read this somewhere in Neo4j documentation too)
Using Neo4j OGM Spring Boot created POJO classes and SaveAll for saving colleciton of nodes.
What I see is that in one situation Dynamic Labels are ignored when the specific node is created via a relationship.
(Dynamic label here defined in abstract BaseNode class)
Dynamic Labels created SaveAll(test1collection):
@Node(value = "TEST1")
public class Test1 extends BaseNode
In this situation i miss the the dynamic labels (entity just only contains the @Node(value) label)
@Relationship(........)
private Test1 testnode
Dynamic Labels are also missing for nodes created by relationship property classes (@RelationshipProperties).
This should work.
What I tried to reproduce the problem you are facing:
1.EntityWithDynamicLabels
-> EntityWithDynamicLabels
2.EntityWithDynamicLabels
-> List[EntityWithDynamicLabels]
3.EntityWithNoDynamicLabels
-> EntityWithDynamicLabels
4.EntityWithNoDynamicLabels
-> List[EntityWithDynamicLabels]
5.-8. The same with @RelationshipProperties
9.-12. Using a "BaseClass
" with @DynamicLabels
All the time the dynamic labels of the related entity got persisted.
It would be really helpful to get a reproducer in this case from your side.
Side note: I think that you are referring to Spring Data Neo4j and not Neo4j-OGM because you are using the (not so new anymore) @Node
annotation provided by Spring Data Neo4j 6 that does not depend on Neo4j-OGM. Also this might be the problem: You are mixing Neo4j-OGM annotations into the entity declaration.