Using neo4j-ogm, I've written the following code, which contains two database calls. I would like it to only have one database call.
public Member loadMemberByDomainSpecificId(String domainSpecificId) {
String query = "match (m:Member {domainSpecificId: {domainSpecificId}}) return m;";
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("domainSpecificId", domainSpecificId);
Session neo4jSession = Neo4jSessionFactory.getInstance().getNeo4jSession();
Member member = neo4jSession.queryForObject(Member.class, query, parameters);
return super.find(member);
}
The first database call is
neo4jSession.queryForObject(Member.class, query, parameters);
The second database call is
return (Member)super(find(member);
super is return session.load(Member.class, member.getId(), 1);
where session is a neo4jSession.
I make the second API call because the first API call fetches only the node / object, and none of its related nodes / objects. The second API call refreshes the node and all its relationships.
Does anyone know how I can efficiently do all of this with only one database call?
queryForObject does not seem to support variable depth as many of the other neo4jSession methods do.