Running into a problem with the Neo4j OGM library and having a relationship to "subclasses":
@NodeEntity class MyEntity{
@GraphId private Long graphId;
...
}
class MyRoot extends MyEntity{
MyResource resource;
...
}
class MyResource extends MyEntity{
@Relationship(type="HAS_CHILD", direction = Relationship.INCOMING)
private MyContainer parent;
...
}
class MyContainer extends MyResource{
@Relationship(type="HAS_CHILD", direction = Relationship.OUTGOING)
private List<MyResource> children = new ArrayList<>();
...
}
Saving a simple graph like this,
and I am unable to get the children back, while the debug log says "More than one class subclasses org.springdot.ogm.eval.entities.MyEntity".
graph to be saved: r=MyRoot{children=[MyResource{graphId=null, name='.1'}, MyResource{graphId=null, name='.2'}, MyResource{graphId=null, name='.3'}, children=[MyResource{graphId=null, name='.4.1'}, MyResource{graphId=null, name='.4.2'}, MyResource{graphId=null, name='.4.3'}]]}
...
16:52:16.880 [main] DEBUG org.neo4j.ogm.metadata.MetaData - More than one class subclasses org.springdot.ogm.eval.entities.MyEntity
16:52:16.881 [main] DEBUG org.neo4j.ogm.metadata.MetaData - More than one class subclasses org.springdot.ogm.eval.entities.MyEntity
...
graph read back: MyRoot{children=[]}
The full example project exhibiting the problem is on Github.