Data Access Object Code Generator
An open source Java tool for PostgreSQL databases.
Documentation
- Overview
- About DAO
- Usage
- Screenshots
- Demo
- Downloads
- Developer Docs
- API
- FAQs
Support
- 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

MDAOG's first reported bug was (hopefully) fixed :) Also support for bigserial datatypes has been added. The generated DAO code will recognize bigserial as a java Long and will go fetch the sequence value on inserts.

This new version of MDAOG adds methods to the DTO objects to allow you to easily duplicate them or test for equality. The ability to specify the DataSource name used by the webapp has also been added. Previously if you wanted to make changes to the DSN you had to modify the PostgreSQLFactory.

A few changes to the GUI were made based on some recommendations as well as some code changes and rebuilding the package to be compatible with older JVMs

The first Alpha Release of MDAOG is available for download. This build allows you to connecto to a PostgreSQL database through MDAOG's Swing GUI and generate DAO source files for accessing the database in your Java web applications. Though it is an Alpha release, the generated code is of high quality and fairly well tested.

The MDAOG Java DAO Code Generator Project is coming to SourceForge. The project home page is up with a bit of information to give you an idea about what it's all about. Jar files and source code will be available soon. If you're interested in the project please leave a comment.

Hosted on:
SourceForge.net Logo