Announcement Announcement Module
No announcement yet.
Neo4j - 1:N relationship without a Set on the start node. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Neo4j - 1:N relationship without a Set on the start node.

    I'd like to have node A - that has a 1:N relationship to nodes B - but I do not want to put a Set<B> on node A (there will be unbounded Bs). I'd like to create Node A and Node Bs separately - and then create the link - and query (Page) for node Bs that are related to to Node A. From the docs - it appears the way to do this is to create a RelationshipEntity. Which I can do. But - if i DID use a Set<B> on node A - these RelationshipEntities would not be needed/created - so is there a way to make a link without using RelationshipEntities? Thanks.


  • #2
    You should be able to create the realtionships with the template class, or using the Neo4J apis directly. If you look at the Good Relationships documentation

    Example 9.2. Relating actors to movies

    You will see that it is using the template to
    Role role = template.createRelationshipBetween(actor,movie,
    Role.class, "ACTS_IN");

    Hope that helps