【问题标题】:Neo4J Java can't load relations: "no writer for...": Neo4J OGM logging error?Neo4J Java 无法加载关系:“no writer for...”:Neo4J OGM 日志记录错误?
【发布时间】:2016-09-12 14:02:21
【问题描述】:

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);

相反?我收到一条令人困惑的日志消息,它说我的一个班级没有作家,但那个班级肯定有作家。我问是因为我想确保我没有忽略任何事情。

干杯,谢谢,

斯蒂芬

【问题讨论】:

    标签: java neo4j neo4j-ogm


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多