endrec
endrec

Reputation: 467

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?

Upvotes: 1

Views: 100

Answers (1)

Michael Hunger
Michael Hunger

Reputation: 41706

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.

Upvotes: 1

Related Questions