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).
I would say that this issue is already done with the current Neo4jAssociationSnapshot
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
Maybe you want to wait until that pull request is integrated
, is this addressed by the pending Neo4j PR?
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.