Closed
Description
I have issue with saving node with multiple relationships (with diferent properties) with the same target node. Repository save() method only save last relationship.
To report this issue, I created this test case (test added to org.springframework.data.neo4j.integration.imperative.RepositoryIT.RelationshipProperties)
@Test
void saveSameNodeWithDoubleRelationship(@Autowired HobbyWithRelationshipWithPropertiesRepository repository) {
AltHobby hobby = new AltHobby();
hobby.setName("Music");
AltPerson altPerson = new AltPerson("Freddie");
AltLikedByPersonRelationship rel1 = new AltLikedByPersonRelationship();
rel1.setRating(5);
rel1.setAltPerson(altPerson);
AltLikedByPersonRelationship rel2 = new AltLikedByPersonRelationship();
rel2.setRating(1);
rel2.setAltPerson(altPerson);
hobby.getLikedBy().add(rel1);
hobby.getLikedBy().add(rel2);
repository.save(hobby);
hobby = repository.loadFromCustomQuery(altPerson.getId());
assertThat(hobby.getName()).isEqualTo("Music");
List<AltLikedByPersonRelationship> likedBy = hobby.getLikedBy();
assertThat(likedBy).hasSize(2);
assertThat(likedBy).containsExactlyInAnyOrder(rel1, rel2);
}
I try it with SDN 6.0.x and master branch.