Data Access Object Code Generator
An open source Java tool for PostgreSQL databases.
- Overview
- About DAO
- Usage
- Screenshots
- Demo
- Downloads
- Developer Docs
- FAQs
- Help Forum
- Discussion Forum
- Bugs
- Feature Requests

About the Data Access Object Design Pattern

Most web applications need to persist data. One method of persisting data is in a relational database using JDBC, another is through EJBs that may then connect to a database. JDBC provides a layer of abstraction over the DBMS's native connection to standardize database access calls. There are still some cases where different features in each vendor's DBMS or their JDBC Driver implementation need different code to perform similar tasks. Consequently, if you need to change your application to use a different vendor's DBMS or you'd like to use EJB's you have to make a significant number of changes to your web application.

The DAO design pattern is another abstraction layer over the persistence mechanism of your application. Your application deals with Data Access Objects and Data Transfer Objects (DTOs) rather than directly calling the JDBC driver. Changing the persistence method at a later date doesn't require your application code to change, only adding a new set of DAOs. Using DAO in your web application allows you to concentrate more on the data you're accessing rather than on the mechanics of how the data is stored and retrieved.

The standardization provided by this new layer also makes it easier to automatically generate the Java code necessary to access your database. Most JDBC calls are very repetitive and time consuming. Using a DAO Generator is a good way to eliminate that work and make your application development faster.

Basically, you have a DAO Factory that you use to instantiate new DAO Objects. The DAO Factory will create a new DAO for the persistence method you determine in the webapp. Each DAO corresponds to a different table in your database. The DAO passes Data Transfer Objects (DTO) between your webapp and the database which represent different records in the database.

You can read more about the DAO Design Pattern in Core J2EE Patterns.

Project News