Neo4J Java 无法加载关系:"no writer for...":Neo4J OGM 日志记录错误?

Neo4J Java can't load relations: "no writer for...": Neo4J OGM logging error?

Neo4J OGM v2.0.4 的代码如下(文件 org/neo4j/ogm/context/GraphEntityMapper.java,第 313--339 行):

    // If the source has a writer for an outgoing relationship for the rel entity, then write the rel entity on the source if it's a scalar writer
    ClassInfo sourceInfo = metadata.classInfo(source);
    RelationalWriter writer = entityAccessStrategy.getRelationalWriter(sourceInfo, edge.getType(), Relationship.OUTGOING, relationshipEntity);
    if (writer == null) {
        logger.debug("No writer for {}", target);
    } else {
        if (writer.forScalar()) {
            writer.write(source, relationshipEntity);
            mappingContext.registerRelationship(new MappedRelationship(edge.getStartNode(), edge.getType(), edge.getEndNode(), edge.getId(), source.getClass(), ClassUtils.getType(writer.typeParameterDescriptor())));
        } else {
            oneToMany.add(edge);
        }
    }

    //If the target has a writer for an incoming relationship for the rel entity, then write the rel entity on the target if it's a scalar writer
    ClassInfo targetInfo = metadata.classInfo(target);
    writer = entityAccessStrategy.getRelationalWriter(targetInfo, edge.getType(), Relationship.INCOMING, relationshipEntity);

    if (writer == null) {
        logger.debug("No writer for {}", target);
    } else {
        if (writer.forScalar()) {
            writer.write(target, relationshipEntity);
        } else {
            oneToMany.add(edge);
        }
    }

但是第一条日志消息不应该被读取

logger.debug("No writer for {}", target);

相反?我收到一条令人困惑的日志消息,它说我的 class 没有作者,但 class 肯定有作者。我问是因为我想确保我没有遗漏任何东西。

干杯和感谢,

斯蒂芬

当您的关系实体是集合时,您可能会看到此调试消息。映射器首先尝试为单个关系找到关系编写器,然后回退到集合。因此,除非您发现您的关系实体没有被持久化,否则您可能无需担心。