我有一个特定的用例,我有一个Neo4j实例,其中一些数据通过OGM映射到实体类,一些数据没有实体类。有一些关系(没有实体类)连接这两种类型的数据。
我已经能够使用OGM查询方法搜索非实体映射节点并返回NodeModel
个实例。但是,当我尝试包含关系时,我会收到以下错误:
21:11:28.707 [main] DEBUG org.neo4j.ogm.MetaData - looking for concrete class to resolve label: SPOKE_B
21:11:28.707 [main] DEBUG org.neo4j.ogm.MetaData - This label is not known in the mapping context. Moving on...
21:11:28.707 [main] DEBUG org.neo4j.ogm.MetaData - No resolving class found!!
21:11:28.707 [main] DEBUG org.neo4j.ogm.MetaData - looking for concrete class to resolve label: HUB
21:11:28.707 [main] DEBUG org.neo4j.ogm.MetaData - This label is not known in the mapping context. Moving on...
21:11:28.707 [main] DEBUG org.neo4j.ogm.MetaData - No resolving class found!!
21:11:28.707 [main] DEBUG org.neo4j.ogm.context.GraphEntityMapper - Relationship (0)-[SGEdge]->(2) cannot be hydrated because one or more required node types are not mapped to entity classes
我查看了一些代码和GraphEntityMapper.mapRelationships(),https://github.com/neo4j/neo4j-ogm/blob/master/core/src/main/java/org/neo4j/ogm/context/GraphEntityMapper.java,只有在两个节点都成功映射到实体类时才返回关系。
因此,我似乎无法使用OGM查询方法来获取未映射到实体类的节点之间的关系。有人知道解决这个问题吗?
我意识到可以使用不同的驱动程序,但我不想维护两个不同的驱动程序连接到同一个数据库。