Consider mapping one-to-one mappings with @PrimaryKeyJoinColumn via relationship in Neo4j

Description

When mapping a one-to-one association using @PrimaryKeyJoinColumn, it may be beneficial to establish a relationship in Neo4j in order to save a node look-up and benefit from node navigation instead (see SharedPrimaryKeyTest for an example).

That'd require some changes on the engine side, as the dialect is only invoked for the two duple operations (for each side of the association), but without any association meta-data.

From IRC:

2014-09-12T13:13:39 <gmorling> we don't materialize the reference as FK in RDMBS either, so why do you think it should be done for neo4j?
2014-09-12T13:14:51 <emmanuel> because in RDBMS, you can do joins freely. In k/v or documents you embed the data or not and if you don't you are a lookup away. But in Neo4J a lookup is the more expensive operation compared to a node jump
2014-09-12T13:15:20 <emmanuel> and I don't know if you can express Cypher queries on /implicit/ associations
2014-09-12T13:15:26 <gmorling> but if you want a relationship, why would you go for this sort of mapping than?
2014-09-12T13:15:48 <emmanuel> because it's conceptually beautiful
2014-09-12T13:15:52 <gmorling> lol
2014-09-12T13:15:58 <emmanuel> true if you write a neo4j only app, you would not
2014-09-12T13:16:07 <emmanuel> but for a multi abckend app you might
2014-09-12T13:16:17 <emmanuel> but even that I grant you remains an uncommon mapping

Environment

None

Assignee

Unassigned

Reporter

Gunnar Morling

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Fix versions

Priority

Minor
Configure