O'Reilly logo

Professional Java for Web Applications by Nicholas S. Williams

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 22Eliminating Boilerplate Repositories with Spring Data JPA

  • Understanding Spring Data’s unified data access
  • Creating Spring Data JPA repositories
  • How to refactor the Customer Support application

WROX.COM CODE DOWNLOADS FOR THIS CHAPTER

You can find the wrox.com code downloads for this chapter at http://www.wrox.com/go/projavaforwebapps on the Download Code tab. The code for this chapter is divided into the following major examples:

  • Spring-Data-JPA Project
  • Customer-Support-v16 Project

NEW MAVEN DEPENDENCIES FOR THIS CHAPTER

In addition to the Maven dependencies introduced in previous chapters, you also need the following Maven dependency. The SLF4J JCL bridge is excluded because your use of Log4j 2 makes this bridge unnecessary.

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>1.5.0.RELEASE</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>jcl-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
 
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.5</version>
            <scope>runtime</scope>
        </dependency>

UNDERSTANDING SPRING DATA’S UNIFIED DATA ACCESS

In Chapter 20, you learned how powerful the Java Persistence API can be, and in Chapter 21 you learned how Spring Framework can make using JPA even easier. Spring takes care of all your transaction management and EntityManager creation and closing so that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required