title: Spring Data Neo4j 4 - @Fetch change to findAll(int depth) always return null
body: <p>I have 3 classes, there are User, Role and UserRole. I want to fetch the data of UserRole, but always return NULL.</p>
  
  <p>This is User Class.</p>
  
  <pre><code>@NodeEntity
  public class User {
      @GraphId
      Long id;
  
      @NotNull
      private String username;
  
      @NotNull
      private String password;
  
      @NotNull
      private String firstName;
  
      @NotNull
      private String lastName;
  
      @NotNull
      private String role;
  
      @NotNull
      private Boolean active;
  
      @Relationship(type = "HAS_ROLE", direction = Relationship.OUTGOING)
      private Set&lt;UserRole&gt; userRoles;
  
      public User() {
          super();
      }
  
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      public String getUsername() {
          return username;
      }
  
      public void setUsername(String username) {
          this.username = username;
      }
  
      public String getPassword() {
          return password;
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
      public String getFirstName() {
          return firstName;
      }
  
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
  
      public String getLastName() {
          return lastName;
      }
  
      public void setLastName(String lastName) {
          this.lastName = lastName;
      }
  
      public String getRole() {
          return role;
      }
  
      public void setRole(String role) {
          this.role = role;
      }
  
      public Boolean getActive() {
          return active;
      }
  
      public void setActive(Boolean active) {
          this.active = active;
      }
  
      public Iterable&lt;UserRole&gt; getUserRoles() {
          return userRoles;
      }
  
      public void setUserRoles(Set&lt;UserRole&gt; userRoles) {
          this.userRoles = userRoles;
      }
  }
  </code></pre>
  
  <p>And this is my Role Class</p>
  
  <pre><code>@NodeEntity
  public class Role {
      @GraphId
      Long id;
  
      @NotNull
      String name;
  
      @Relationship(type = "HAS_ROLE",direction = Relationship.OUTGOING)
      @JsonIgnore
      private Set&lt;UserRole&gt; userRoles;
  
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public Set&lt;UserRole&gt; getUserRoles() {
          return userRoles;
      }
  
      public void setUserRoles(Set&lt;UserRole&gt; userRoles) {
          this.userRoles = userRoles;
      }
  
      public Role() {
          super();
      }
  }
  </code></pre>
  
  <p>And this is my UserRole Class</p>
  
  <pre><code>@RelationshipEntity(type = "HAS_ROLE")
  public class UserRole {
      @GraphId
      Long id;
  
      @StartNode
      @Relationship(type="HAS_ROLE", direction=Relationship.INCOMING)
      User user;
  
      @EndNode
      @Relationship(type="HAS_ROLE", direction=Relationship.INCOMING)
      Role role;
  
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      public User getUser() {
          return user;
      }
  
      public void setUser(User user) {
          this.user = user;
      }
  
      public Role getRole() {
          return role;
      }
  
      public void setRole(Role role) {
          this.role = role;
      }
  
      public UserRole(User user, Role role) {
          super();
          this.user = user;
          this.role = role;
      }
  
      public UserRole() {
          super();
      }
  }
  </code></pre>
  
  <p>I want to show all the User data, but the result always show userRoles NULL. I am using findAll(1) and findAll(2) but nothing different.</p>
  
  <p>Its different from SDN 3, we only add @Fetch to the field. In SDN 4, no @Fetch annotation. How i can fetch all the data?</p>
  
  <p><strong>UPDATE!!</strong></p>
  
  <p>I changed the class like Luanne answer, and modified the User class like this :</p>
  
  <pre><code>@NodeEntity
  public class User {
      @GraphId
      Long id;
  
      @NotNull
      private String username;
  
      @NotNull
      private String password;
  
      @NotNull
      private String firstName;
  
      @NotNull
      private String lastName;
  
      @NotNull
      private String role;
  
      @NotNull
      private Boolean active;
  
      @Relationship(type = "HAS_ROLE")
      private Set&lt;UserRole&gt; userRoles;
  
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      public String getUsername() {
          return username;
      }
  
      public void setUsername(String username) {
          this.username = username;
      }
  
      public String getPassword() {
          return password;
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
      public String getFirstName() {
          return firstName;
      }
  
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
  
      public String getLastName() {
          return lastName;
      }
  
      public void setLastName(String lastName) {
          this.lastName = lastName;
      }
  
      public String getRole() {
          return role;
      }
  
      public void setRole(String role) {
          this.role = role;
      }
  
      public Boolean getActive() {
          return active;
      }
  
      public void setActive(Boolean active) {
          this.active = active;
      }
  
      @Relationship(type = "HAS_ROLE")
      public Set&lt;UserRole&gt; getUserRoles() {
          return userRoles;
      }
  
      @Relationship(type = "HAS_ROLE")
      public void setUserRoles(Set&lt;UserRole&gt; userRoles) {
          this.userRoles = userRoles;
      }
  
      public User(){
          super();
      }
  }
  </code></pre>
  
  <p>After save the data, and show it, the Roles are shown like this :</p>
  
  <pre><code>[{"id":27,"username":"daviduck123","password":"admin","firstName":"David","lastName":"Vincent","role":"admin","active":null,"roles":{"id":"29","name":"ROLE_ADMIN"}}]
  </code></pre>
  
  <p>But after that I try to show again all the data, and its back to NULL again like this :</p>
  
  <pre><code>[{"id":27,"username":"daviduck123","password":"admin","firstName":"David","lastName":"Vincent","role":"admin","active":null,"roles":null}]
  </code></pre>
  
  <p>This is my repository <a href="https://github.com/daviduck123/neo4j-ogm-infiniteloop" rel="nofollow">https://github.com/daviduck123/neo4j-ogm-infiniteloop</a></p>