Database Reference
In-Depth Information
First step - Neo4jTemplate
Neo4jTemplate, also known as
org.springframework.data.neo4j.support.Neo4jTemplate
, is one of the
convenience classes that provide methods for performing CRUD operations over the Neo4j
database. It provides functionality that is analogous to
org.neo4j.graphdb
.GraphDatabaseService
provided by Neo4j. Apart from CRUD operations, it also
provides various methods for searching and querying the Neo4j database.
Let's perform the following steps and set up a Maven-based Spring Data Neo4j project and
then use Neo4jTemplate to perform CRUD and search operations:
1. Download Maven 3.2.3 from
http://maven.apache.org/download.cgi
.
2. Once the archive is downloaded, browse the directory on your filesystem and ex-
tract it.
3. Define the system environment variable
M2_HOME=<location of extrac-
ted Archive file >
.
4. Add
$M2_HOME/bin/
to your
$PATH
variable.
5. Next, open your console and browse the location where you want to create your
new maven project and execute the following command:
mvn archetype:generate
-DgroupId=org.neo4j.spring.samples
-DartifactId=Spring-Neo4j
-DarchetypeArtifactId=maven-archetype-quickstart
-DinteractiveMode=false
Note
Using appropriate plugins, you can create maven projects from the IDE itself. For
example, in Eclipse, you can install and use M2E plugin—
http://eclipse.org/m2e/
.
6. It will take some time as maven will download the required dependencies to create
your project. You will see a directory
Spring-Neo4j
being created as soon as
the command is successfully completed.
7. Next, open your
Spring-Neo4J\pom.xml
file and add the following proper-
ties just below the
<name>Spring-Neo4J </name>
tag. These properties
hold the version of various dependencies that will be used within the project: