简体   繁体   English

使用Spring Data Neo4j与Neo4j中的任意Map.Entry相关

[英]Relate to an arbitrary Map.Entry in Neo4j using Spring Data Neo4j

I'm trying to store properties as nodes in my Neo4j graph, which then can be reached using the Spring Data Rest API. 我正在尝试将属性存储为Neo4j图中的节点,然后可以使用Spring Data Rest API来访问。 (And then later I'd like to find object with same properties in my graph.) The JSON representation of my object should be like (然后,我想在图形中找到具有相同属性的对象。)对象的JSON表示应类似于

{
  //...
  "properties": {
    "key": "value"
  }
  //...
}

The simplest way would be 最简单的方法是

@Data
@NodeEntity
public class ObjectWithProperties {
    //...
    @RelatedTo
    Map<String, Object> properties;
    //...
}

Obviously, this does not work, as Map.Entry is not a @NodeEntity. 显然,这不起作用,因为Map.Entry不是@NodeEntity。

Is there an easy way to achieve this? 有没有简单的方法可以做到这一点?

There is DynamicProperties as field value which is a one-level map of string-value pairs. 有一个DynamicProperties作为字段值,它是一个字符串值对的一级映射。 But it is stored as node-properties not as relationships to other nodes. 但是它存储为节点属性,而不是与其他节点的关系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM