I'm asking if this is doable in Spring-Data-Neo4j (SDN) or Neo4j OGM because I understand that SDN actually uses Neo4j-OGM underneath.
Assume I have 2 Java objects that I need to map to a single Graph node:
@NodeEntity
public class User {
@GraphId
private Long id;
private ComplexInfo info;
}
@NodeEntity
public class ComplexInfo {
@GraphId
private Long id;
private Long age;
private String name;
}
This way, I'll have a relation between 2 nodes. User and ComplexInfo.
But is there a way to map this as a single node, where the primitive variables (including String and wrapper Objects such as Long, Integer..etc) of the ComplexInfo java object would be persisted within the User node and there would be no existence of the ComplexInfo node ?
Effectively it would be as if I have mapped my User object this way:
@NodeEntity
public class User {
@GraphId
private Long id;
private Long age;
private String name;
}
I don't want to have 2 nodes for this because the ComplexInfo class is no more than a collection of reusable properties and there is no benefit of having a relationship between it and the node having this properties.