Use Neo4J navigation over lookups when possible

Description

Let's assume entity A and B and a many to many relationship between A and B.

When loading A, we load the association information by navigating the relationship in Neo4J. From there we could navigate to the node representing the entity B. But in the current code, we do a lookup from the EntityKey to load all entities leading to a hit on the Neo4J index. Which AFAIK is suboptimal.

We could imagine that when we load the Tuple related to the RowKey (Neo4JAssociationSnapshot.get()), we could store the link to the target node (node representing B).
When the grid dialect plans to load B, we could check this caching structure and load B from the node link instead of a lookup.

Such a cache structure should probably be cached by transaction and per session (and possibly using some weak reference).

Environment

None

Activity

Show:
Davide D'Alto
February 18, 2014, 5:30 PM

I would say that this issue is already done with the current Neo4jAssociationSnapshot

Davide D'Alto
February 18, 2014, 5:31 PM

Thre was an error in the dialect, thought, and node were not saved as expected. This should be solved with the pull request that upgrades Neo4j to version 2.0

Davide D'Alto
February 18, 2014, 5:32 PM

Maybe you want to wait until that pull request is integrated

Gunnar Morling
May 22, 2014, 10:11 AM

, is this addressed by the pending Neo4j PR?

Davide D'Alto
May 22, 2014, 10:42 AM

I don't think so, in Neo4jAssociationSnapshot we store the relationship and therfore the nodes connected to it but in the dialect we are still doing some lookups that can be avoided.

Assignee

Unassigned

Reporter

Emmanuel Bernard

Labels

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Priority

Major
Configure