cancel
Showing results for 
Search instead for 
Did you mean: 

Manually converting Result to NodeEntity

shayantest2
Node Clone

session.query(String s, Map<String, ?> map) returns Result.

In the Result, I can get a Path in which there are two nodes() and relationships() methods that give me the nodes an relationships inside the Path. However the nodes are of type org.neo4j.graphdb.Node not my own class annotated with @NodeEntity. How can I manually convert the Node to my own class with OGM (not, e.g., by manually assigning the attribute values one-by-one)?

4 REPLIES 4

which version of SDN
what does your code and query look like?
why are you using embedded?

No SDN. Neo4j 3.5.8 and neo4j-ogm-core 3.1.11 or 3.1.13 if I'm right. Where did I mention embedded? However, yes, I use the embedded version of neo4j.

I think they are only auto-mapped if you provide a target class for the result or use a repository method.

embedded because of: org.neo4j.graphdb.Node

bierman_bob
Node Link

Manual conversion is unnecessary, you need to add the package name(s) of your NodeEntity objects via SessionFactory when you build your ogm Session. Any entities not found in those packages will default to a NodeModel object. fyi @michael.hunger I have used custom queries via session.query and they do get auto-mapped to any annotated entities, they do not have to be repo methods.

package org.neo4j.ogm.session;

public SessionFactory(Configuration configuration, String... packages) { . . .