Chapter 5. DAO Support and JDBC Framework

This chapter introduces Spring's support for the Data Access Object (DAO) pattern. This is followed by an in-depth discussion of Spring's JDBC framework.

The DAO pattern is one of the most important patterns commonly used in J2EE applications, and Spring's data access architecture provides uniquely sophisticated yet straightforward support for it.

The Spring JDBC framework is built on top of the core J2SE JDBC API, and it is the lowest level data access technology that Spring supports. Other, higher level technologies are iBATIS SQL Maps, Hibernate, JDO, and other O/R mapping tools. These technologies also use JDBC as their underlying API for accessing a relational database but they all provide their own higher level abstraction API that you work with. In Chapter 7 we will discuss these other technologies in detail.

To begin with, we'll spend some time looking at JDBC itself. We will briefly look at what works well and what does not work so well with a traditional JDBC approach. We assume that you have some experience using JDBC. If you don't, you should start with a basic JDBC tutorial before continuing with this chapter. Sun provides a JDBC tutorial on their Java website at http://java.sun.com/docs/books/tutorial/jdbc/index.html.

We will then introduce the core functionality of Spring's JDBC framework. The focus of Spring's approach is to make it easier to use the strengths present in the JDBC API while abstracting away the rough spots. We ...

Get Professional Java™ Development with the Spring Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.