Database Reference
In-Depth Information
Listing 9.6. XML-based Spring configuration
The neo4j:config entry is used by SDN to perform many initialization activities; for
example, you can supply the storeDirectory attribute as a convenient way to refer to
a graph database (creating a new embedded one if it doesn't exist). From SDN 3.0 onward,
it'smandatorythatyouusethe base-package attributetospecifythedirectoryorlistof
directories where your domain entities are defined.
Note
You can achieve the same outcome by using Spring Java configuration if you don't fancy
XML.
Let'smoveontolookathowyoucanusethe Neo4jTemplate classtointeractwithyour
entities.
9.3.2. Neo4jTemplate class
Neo4jTemplate is an SDN class that can be instantiated and used directly or made
available to your application when Spring is initialized. Following in the spirit of the other
successful Spring template classes (such as JDBCTemplate and JMSTemplate ), the
Neo4jTemplate class aims to provide a convenient and simplified API for interacting
with the low-level classes and behavior requirements of the underlying Neo4j graph-based
classes.
It's interesting to note that the SDN framework itself makes use of Neo4jTemplate to
perform many of its own internal tasks, delegating to it as appropriate. But the template
itself isn't restricted to internal use only and can also be used as one of the options for in-
voking basic functionality surrounding SDN entities.
Search WWH ::




Custom Search