cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

List of RelationshipProperties

@Node
public class User {
    @Id
    @GeneratedValue(generatorClass = UUIDStringGenerator.class)
    private String id;
    private String username;
}

@RelationshipProperties
public class Member {
    @RelationshipId
    private Long id;

    @TargetNode
    private User user;

    private String type;
}

@Node
public class BusinessUnit {
    @Id
    @GeneratedValue(generatorClass = UUIDStringGenerator.class)
    private String id;
    private String name;
    @Relationship
    private List<Member> members;
}

@Transactional
public void addMember(String name) {
   User user = userRepository.save(User.builder()
                .username(name)
                .build());
   BusinessUnit bu = businessUnitRepository.findByName("xxx");
   bu.getMembers().add(Member.builder()
       .type("gold")
       .user(user)
       .build());
   businessUnitRepository.save(bu);
}

Adding one Member works.

But adding a second one does not create the relationship

What am I doing wrong?

 

1 ACCEPTED SOLUTION

You are probably using SDN 6.3.3, right?
There was a bug that got fixed with 6.3.4: https://github.com/spring-projects/spring-data-neo4j/issues/2599

View solution in original post

3 REPLIES 3

You are probably using SDN 6.3.3, right?
There was a bug that got fixed with 6.3.4: https://github.com/spring-projects/spring-data-neo4j/issues/2599

Yes was using 6.3.3, bumped to 7 and the problem was fixed. thank you

An aside, am now getting the following warning on startup. Which seems to contradict what the documentation says

"The entity Member is using a Long value for storing internally generated Neo4j ids. The Neo4j internal Long Ids are deprecated, please consider using an external ID generator"

Going straight to a pre-release 7 is a good move by you to provide feedback.
Regarding the warning: SDN 7 is created with (not yet released) Neo4j 5 in the back of our head. There is a change in the identifiers. Please ignore this warning for now because we are still not sure if we will just stick with the old id format and dismiss this warning in the GA version.
Already this was valuable feedback 👍, thanks.