Database Reference
In-Depth Information
Youcanmakeuseofthe
graphDatabaseService
attributetopointtoaparticularpre-
configured Neo4j instance that should be used. In that case you'd also need to define a
factory bean to create an appropriate Neo4j instance, as shown in the following snippet:
<neo4j:config graphDatabaseService="graphDatabaseService" />
<bean id="graphDbFactory"
class="org.neo4j.graphdb.factory.GraphDatabaseFactory"/>
<bean id="graphDatabaseService"
scope="singleton"
destroy-method="shutdown"
factory-bean="graphDbFactory"
factory-method="newEmbeddedDatabase">
<constructor-arg value="target/config-test"/>
</bean>
As of SDN 3.0, the
base-package
XML element is mandatory, and you're expected
to supply a list of all the packages that SDN should search to find your annotated domain
entities. If you're engaging in cross-store persistence, you'll also need to supply the
en-
tityManagerFactory
attribute value (not shown here).
If you'd like to make use of a type representation strategy other than the default one
(SDN 3.x defaults to label-based; SDN 2.x defaults to legacy indexed-based), you can
optionally define a bean named
typeRepresentationStrategyFactory
of type
org.springframework.data.neo4j.support.typerepresentation.
TypeRepresentationStrategyFactory
,
asshowninthefollowingsnippet,choosinganappropriatevalueforthesecondconstructor
argument:
<bean id="typeRepresentationStrategyFactory"
class="org.springframework.data.neo4j.support.typerepresentation.TypeRepresentationStrategyFactory">
<constructor-arg index="0" ref="graphDatabase"/>
<constructor-arg index="1" value="Indexed"/>
</bean>
More information on the available options can be found in the “Entity type representation”
section in chapter 20 of Michael Hunger's
Good Relationships
at
http://docs.spring.io/
For more configuration options see the official website.