Spring provides @QueryResult
annotation to map the returned values to a java object. But seems like the class annotated with @QueryResult
can have only instance variables of primitive type. If it is an object then it gets mapped to Map<String, Object>
.
Is there any way to map this Map<String, Object>
to a java object? I tried but keep getting null value
For instance,
MATCH (n{name:'x'}) return {id: ID(n), labels: labels(n)}
Want to match return value of this query to
@QueryResult
class QueryResult{
NodeInfo node;
}
class NodeInfo{
Long id;
String []labels;
}
Mapping works if class is defined as
@QueryResult
class QueryResult{
Map<String, Object> node;
}