Imagine you have a class hierarchy like Person and Developer

And you have a person repo but the nodes in the db are actually developers.

Then you would want to get the correct instances back (Developer) but requested 
target type is Person

How would you imagine to configure it so that it doesn't look what the node is 
in the graph but just takes the requested type?


Michael

Am 06.03.2014 um 15:54 schrieb Gwendal Mousset <gwendal.mous...@gmail.com>:

> Hi everyone, 
> 
> I use neo4j 2.0.1 with rest api. 
> To obtain better performances in my webapp, I refactor my code by using 
> @QueryResult objects and do more "big" requests instead of many small 
> requests.
> But the logs show me than each time I get an object from the query result, a 
> request is sent:
> 
> 2014-03-06 15:15:43,208 - DEBUG: SpringRestCypherQueryEngine - Executing 
> remote cypher query: match (n) where id(n)={nodeId} return labels(n) as 
> labels params {nodeId=509}
> 
> This request only get the labels of a node, and it seems there is no cache, 
> the request can be sent several time for a same node.
> On a collection, dozens of requests are sent...
> 
> I seek in SDN code what are the reason, and i found Neo4jEntityConverterImpl :
> 
> public <R extends T> R read(Class<R> requestedType, S source, MappingPolicy 
> mappingPolicy, final Neo4jTemplate template) {
>         // 1) source -> type alias
>         // 2) type alias -> type
>         // 3) check for subtype matching / enforcement
>         final TypeInformation<R> requestedTypeInformation = requestedType == 
> null ? null : ClassTypeInformation.from(requestedType);
>         final TypeInformation<? extends R> targetType = 
> typeMapper.readType(source, requestedTypeInformation); <-- causes get labels 
> request
> 
> ...... //
> }
> 
> If I correctly understand, this code determines which classes must be 
> instantiate. But what i don't understand is that requestedTypeInformation and 
> targetType have the same value.
> So would it be possible to bypass the db check and only take the 
> requestedTypeInformation value ?
> 
> I found a quite similar question on stakoverflow: 
> http://stackoverflow.com/questions/22209220/unnecessary-additional-label-requests-for-nodes
> 
> Thanks
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to neo4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to