Database Reference
In-Depth Information
System.out.println("\n Completed Dumping of
Movies.............\n");
In the preceding method, we are fetching all movies from our Neo4j database and
then printing it on the console. The implementation of the
findAll()
method
will be injected by Spring and added to our
MovieRepository
. For other
available methods, refer to
http://docs.spring.io/autorepo/docs/spring-data-neo4j/
6. Next, invoke this new method from
MainClass.java
; open your console and
execute the following Maven command:
$M2_HOME/bin/mvn -Dexec.cleanupDaemonThreads=false -q
exec:java -D
exec.mainClass="org.neo4j.spring.samples.MainClass"
The output after execution of the preceding command is shown in the following screen-
shot:
We can also declare some custom methods that are based on the results of custom Cypher
queries, which we might have written to traverse our domain model.
For example, we can declare the following method in our
MovieRepository.java
class and then replace
movieRepo.findAll()
with
movieRepo.getAllMovies()
in
PersistNeo4JData.java
: