I am using SDN 4 and neo4j-ogm 1.1.4
I am trying to fetch my data using findById(Long id) GraphRepository, but always return null. After that I am trying to use findByName(String name) and its worked. I know there is alternative using findOne(Long id, int depth), but when I want to make custom query, for example findByObjectId(Long id), it will be trouble.
After try manual query at neo4j, it return null too. So any issue about this ?
@NodeEntity
public class Fetch1 {
@GraphId Long id;
private String name;
@Relationship(type="HAS_FETCH2")
@JsonIgnore
private List<Fetch2> fetch2;
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;
}
@Relationship(type="HAS_FETCH2")
@JsonIgnore
public List<Fetch2> getFetch2() {
return fetch2;
}
@Relationship(type="HAS_FETCH2")
@JsonIgnore
public void setFetch2(List<Fetch2> fetch2) {
this.fetch2 = fetch2;
}
@Override
public String toString() {
return "Fetch1 [id=" + id + ", name=" + name + ", fetch2=" + fetch2 + "]";
}
}
@NodeEntity
public class Fetch2 {
@GraphId Long id;
private String name;
@Relationship(type="HAS_FETCH2", direction=Relationship.INCOMING)
@JsonIgnore
private Fetch1 fetch1;
@Relationship(type="HAS_FETCH3")
@JsonIgnore
private List<Fetch3> fetch3;
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;
}
@Relationship(type="HAS_FETCH2", direction=Relationship.INCOMING)
@JsonIgnore
public Fetch1 getFetch1() {
return fetch1;
}
@Relationship(type="HAS_FETCH2", direction=Relationship.INCOMING)
@JsonIgnore
public void setFetch1(Fetch1 fetch1) {
this.fetch1 = fetch1;
}
@Relationship(type="HAS_FETCH3")
@JsonIgnore
public List<Fetch3> getFetch3() {
return fetch3;
}
@Relationship(type="HAS_FETCH3")
@JsonIgnore
public void setFetch3(List<Fetch3> fetch3) {
this.fetch3 = fetch3;
}
@Override
public String toString() {
return "Fetch2 [id=" + id + ", name=" + name + ", fetch1=" + fetch1 + ", fetch3=" + fetch3 + "]";
}
}
And this is my Repository
public interface Fetch1Repository extends GraphRepository<Fetch1>{
Fetch1 findById(Long id);
Fetch1 findByFetch2Id(Long id);
Fetch1 findByFetch2Name(String name);
}