img
.
Figure 10-9 shows the list in STS after all the dependencies were added.
Figure 10-9. Maven dependencies for the Spring Data JPA project
After adding the dependencies, we can proceed to explore Spring Data JPA's features.
Database Operations Using Spring Data JPA Repository Abstraction
One of the main concepts of Spring Data and its all subprojects is the Repository abstraction, which
belongs to the Spring Data Commons project (www.springsource.org/spring-data/commons). At the time
of this writing, it's at version 1.1.0.RELEASE. In Spring Data JPA, the repository abstraction wraps the
underlying JPA EntityManager and provides a simpler interface for JPA-based data access. The central
interface within Spring Data is the org.springframework.data.repository.Repository<T,ID extends
Serializable> interface, which is a marker interface belonging to the Spring Data Commons
distribution. Spring Data provides various extensions of the Repository interface; one of them is the
org.springframework.data.repository.CrudRepository interface (which also belongs to Spring Data
Commons project), which we will discuss in this section.
The CrudRepository interface provides a number of commonly used methods. Listing 10-30 shows
the interface declaration, which is extracted from Spring Data Commons project source code.
Listing 10-30. The CrudRepository Interface
package org.springframework.data.repository;
import java.io.Serializable;
@NoRepositoryBean
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home