简体   繁体   中英

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. (And then later I'd like to find object with same properties in my graph.) The JSON representation of my object should be like

{
  //...
  "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.

Is there an easy way to achieve this?

There is DynamicProperties as field value which is a one-level map of string-value pairs. But it is stored as node-properties not as relationships to other nodes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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