Chapter 12. Data Access Objects

Table of Contents

Best practices and DAO
Data Access Objects DAO
Weaving the application structure
Paper book order
eBook order
Defining the application layers
DAO and DaoFactory
Creating DAOs with generics

Best practices and DAO

This chapter will explain two approaches you might use as a structure for your Hibernate application. Both are based on DAO (Data Access Objects). First, I will explain the DAO as defined in the Java blueprints. Then we will discover the general requirements for a Hibernate application.

Finally, we will continue with the examples showing implementations for Java 1.5 with generics and an implementation for older Java versions. I will try to explain the ideas behind each approach to make you better understand what you are doing.