Announcement Announcement Module
No announcement yet.
Neo4j: Node as RelationshipEntity-Property Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Neo4j: Node as RelationshipEntity-Property


    i am trying to create a relationship between two entities "guest" and "product" with the additional information of an "orderPoint", which is itself an entity.

    public class OrderPoint extends DescribedEntity {
    @RelationshipEntity(type = "orders")
    public class Order implements Serializable {
       protected Date createdAt;
       @RelatedTo(type = "ordersAt")
       protected OrderPoint orderPoint;
    Order.createdAt works fine, Order.orderPoint does not. I am able to set the orderPoint and to save the relationship without an error, but i cannot fetch the orderPoint afterwards. Well, saving the relationship without an error doesn't mean it has to work.. is Spring Data Neo4j able to work this way?

    I am using Spring Data Neo4j 2.1. Snapshot.

    Markus Schulte

  • #2

    The underlying storage literally cannot do what you ask. So you need to turn that relationship into a node to be able to link it three ways.

    As for SDN, are you saying the behaviour ought to be that when you try to do what you did, some validation should happen and an error message should pop up? In that case, feel free to help us with the design: - I'd suggest using the form of a failing test that illustrates what you would like to see?




    • #3
      Sounds like a vertex node. I have a few of those in my application, and yes you have to make it its own node. Basically, you wanted a single relationship to relate three separate nodes. a Relationship can only relate between two nodes.

      It really isn't bad that you have to create a vertex node, you will now have three separate relationships in that node between the three outer nodes. But that then means that for each node in the vertex node/relationship can each have its own type and values. So in reality I view having to create a separate vertex node is much more powerful.