neo4j / sdn-rx

Nextgen Spring Data module for Neo4j supporting (not only) reactive data access and immutable support
https://neo4j.github.io/sdn-rx
Apache License 2.0
65 stars 23 forks source link

Retrieving Node with self-relationship #172

Closed swapyinc closed 4 years ago

swapyinc commented 4 years ago

I created a node with a self-relationship like below (simple user follows user relationship)

@Node
public class User {

    @Id
    @GeneratedValue
    private Long id;
    private String userId;
    private String username;
    private String name;
    private String profilePic;

    @Relationship(type = "FOLLOWING", direction = Relationship.Direction.INCOMING)
    private Set<User> followers;
}

I can save the nodes with relationship but I got the below mapping exception when I try to retrieve the node

org.springframework.data.mapping.MappingException: Error mapping Record<{n: {__internalNeo4jId__: 0, User_FOLLOWING_User: [], profilePic: "testPic", name: "Amr", userId: "test_id", username: "amrkhaled"}}>

I use the below dependency

<dependency>
    <groupId>org.neo4j.springframework.data</groupId>
    <artifactId>spring-data-neo4j-rx-spring-boot-starter</artifactId>
    <version>1.0.0-beta01</version>
 </dependency>
meistermeier commented 4 years ago

First of all thanks for using SDN/RX. Could you upgrade your dependency to 1.0.0-beta04? We improved the handling of relationships a lot in the latest beta versions. If the problem still exists it would be very helpful if we can get the whole error message because the root exception helps us even more to see what is not working.

swapyinc commented 4 years ago

Thanks, it worked after upgrading to 1.0.0-beta04