Database Reference
In-Depth Information
9.4. Object-graph mapping options
SDN offers two modes to perform the mapping between your domain POJOs and the un-
derlying graph entities: simple mapping and advanced mapping. Understanding the differ-
ences in how these modes operates will help you assess the trade-offs in each approach
and decide which one is most appropriate for your project, should you choose to use SDN.
Choosing is a little bit like deciding between DOM and SAX XML parsers—both do the
same thing, parse XML, but in very different ways with implications for the choice taken.
Regardless of whether you choose the simple or advanced mapping mode, the process for
determiningwhatgetsmappedtowhatisthesameforbothandwasconceptuallydescribed
in section 9.2.2 for annotating the domain model. Very briefly, this mapping process in-
volves SDN parsing and analyzing all known node and relationship entities. With a little
helpfromtheJavareflectionAPI,SDNbuildsupanin-memorymetamodelofthemapping
rules. These rules are then used by each implementation to perform the grunt work, so to
speak—theworkofrunningbackwardsandforwardsbetweenthedomainmodelandgraph
primitives, translating when each sees fit.
And then there were two ...
Prior to the release of Spring Data Neo4j version 2.0.0, only the advanced approach
(AspectJ-based mapping) was supported. AspectJ is a Java implementation of the aspect-
oriented programming (AOP) paradigm—see http://eclipse.org/aspectj . Within SDN, it
looks to dynamically intercept method calls on your POJOs as the mechanism for seam-
lessly integrating the Neo4j database and Java domain model.
Reacting tofeedbackfromthecommunity,thesimplemappingmodewasaddedtoaddress
many of the issues and concerns that were raised in relation to the AspectJ tooling, as
well as some other more general implications present with this more complicated setup. It
shouldbenotedthatmoreeffortisnowbeingfocusedonupgradingandmakingthesimple
model the de facto approach to using SDN.
Search WWH ::




Custom Search