12 Data Access Pattern
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 database, a Lightweight Directory Access Protocol (LDAP) repository, a file system, a web service, 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) operations. 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 data source by ...
Get Professional Java EE Design Patterns 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.