Java Reference
In-Depth Information
12
WHAT'S IN THIS CHAPTER?
Discussion regarding the origins of the data access pattern
Examination of the related data transfer object
How the DAO and factory pattern work together
An introduction to the JPA and ORM
A simple implementation of the DAO
An improved implementation using generics
A discussion regarding the role of DAO in modern Java EE
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
The wrox.com code download for this chapter is found at www.wrox.com/go/
projavaeedesignpatterns on the Download Code tab. The code is in the Chapter 12
download and individually named according to the names throughout the chapter.
It is unimaginable to think of an enterprise application that does not in some way interact
with a data source. The data source may be a relational, object‐oriented or NoSQL data-
base, a Lightweight Directory Access Protocol (LDAP) repository, a i le system, a web ser-
vice, or an external system. From whatever source the data comes, the enterprise application
must interact with it and perform basic create, retrieve, update, and delete (CRUD) opera-
tions. Almost all servers use such data sources to persist sessions or long‐running processes
seamlessly.
The way in which you use data sources can vary substantially, and their implementation
can differ widely. There are different SQL dialects, such as Postgre SQL and Oracle. The
simple objective of the data access object (DAO) pattern is to encapsulate access to the
 
Search WWH ::




Custom Search