Database Reference
In-Depth Information
@Query("match (n) return n;")
public Iterable<Movie> getAllMovies();
We have annotated the preceding method with the @Query annotation, which will in-
struct the framework to execute the given query and provide the results back to users via
Iterable<Movie> . So whenever the user invokes getAllMovies() , the frame-
work will execute the given Cypher query and provide the results.
The results will be the same, but the point here is when we did not provide any imple-
mentation of either of the methods, then who provided them? The answer is, Spring Data
does that for you. All the boilerplate code has been automatically injected into your repos-
itories and you just need to focus on your domain model and queries.
In this section, we have explored the Spring Data repositories and how they can be used to
avoid all boilerplate code; thus, developers need to focus only on the business logic and
the domain-specific queries, which not only results in faster development cycles but also
provides a much cleaner and readable code.
Let's move further and discuss advanced mapping of entities with AspectJ.
Search WWH ::




Custom Search