Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 3, 2021. It is now read-only.
This repository was archived by the owner on May 3, 2021. It is now read-only.

Persisting self reference relationship with both directions leads to missing relationship in DB #119

@thePhil

Description

@thePhil

Hoi,

unfortunately, I think I found a bug when trying to persist the following type of relationship:

public class Hobby {
	@Id @GeneratedValue private Long id;
	private String name;

	/**
	 * Test if reverse relationship to same node type get persisted correctly.
	 */
	@Relationship(type = "SimilarTo", inverse = "similarHobbyOf")
	private Hobby similarHobby;

	@Relationship(type = "SimilarTo", direction = Relationship.Direction.INCOMING)
	private Hobby similarHobbyOf;	

	// included to ensure empty relationships do not cause deletion
	@Relationship("EmptyRelationship")
	private List<Hobby> noHobbies;
       
// remaining class omitted
}

I would expect the following persistence result:
image

Unfortunately I see this result (Note the missing SimilarTo relationship on the bottom right):
image

A reproducer test can be found here: https://github.com/thePhil/sdn-rx/blob/0db4928db32d8128d8020f5ea7f24bb8ded316f9/spring-data-neo4j-rx/src/test/java/org/neo4j/springframework/data/integration/imperative/RepositoryIT.java#L547

The code in #113 also still fails the test, not sure if the resolve of #117 would also fix this bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions