Spring Data Neo4j查询路径映射问题求教!请各位大神指点!

查询语句如下:

MATCH data = (a)-[*1..2]->(b) RETURN nodes(data) as nodes, relationships(data) as relationships;

问题总结:

如果直接在Repository中使用@Query查询

1、直接用对象接收报错:Could not find mappable nodes or relationships inside Record<{nodes: [node<58501>, node<15619>], relationships: [relationship<5>]}> for org.springframework.data.neo4j.core.mapping.DefaultNeo4jPersistentEntity@270d6606

2、用List<Map<String, Object>>接收报错:Records with more than one value cannot be converted without a mapper

如果用Neo4jClient查询
1、用Collection<Map<String,Object>>接收 返回值value为空{}

2、直接用对象接收报错:No converter found capable of converting from type [org.neo4j.driver.internal.value.ListValue] to type [com.kh.graph.domain.PathResult]

下面是我创建的实体

@Data
public class PathResult {

    private List<NodesVO> nodes;

    private List<RelationshipsVO> relationships;
}



@Data
@Node
public class NodesVO {

    @Id
    @GeneratedValue
    private Long id;

    private List<String> labels;

    private Map<String, Object> properties;
}



@Data
@RelationshipProperties
public class RelationshipsVO {

    @Id
    @GeneratedValue
    private Long id;

    private Long start;

    private Long end;

    private String type;

    private Map<String, Object> properties;
}

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值