Chapter 21Using JPA in Spring Framework Repositories
- Understanding Spring repositories and taking advantage of transactions
- Setting up persistence in Spring Framework
- Implementing and using JPA repositories
- Converting data with DTOs and entities
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-JPA Project
- Customer-Support-v15 Project
NEW MAVEN DEPENDENCIES FOR THIS CHAPTER
In addition to the Maven dependencies introduced in previous chapters, you also need the following Maven dependency:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.18.1-GA</version>
<scope>runtime</scope>
</dependency>
USING SPRING REPOSITORIES AND TRANSACTIONS
Before Object-Relational Mappers became so common and the JPA Persistence API was first released, Spring Framework’s org.springframework.jdbc.core.JdbcTemplate provided a standard, simplified way to persist and retrieve entities using JDBC in Spring Framework applications. In addition to making table-to-entity translation easier, the JdbcTemplate also recognized the various vendor-specific SQLExceptions and error codes that a JDBC driver could ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access