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

Frequently Asked Questions

What is the DAO Design Pattern?
The Data Access Object Design Pattern is one of the Core J2ee Design Patterns. For more information view the About DAO page.
What does MDAOG do?
MDAOG generates Java source files for accessing data for your web application. It creates the DAOs, DTOs Exceptions and Factories necessary to add, edit, delete and count the data in the database.
What databases does MDAOG support?
Currently, the only database tested with MDAOG has been PostgreSQL. The reason for this is that I like PostgreSQL because it is open source, supports a number of useful features including sequences, transactions, views and because of it's performance, especially under heavy concurrent access.

It should work with Oracle but there haven't been any tests yet. MySQL wouldn't work because of MDAOG's current expectance of sequences but hopefully in the future there will be multi DB support. Not having views limits some, but not all, of the benefits in development speed.

Why was MDAOG written?
When you build a RDBMS backed web application, you have to determine the objects you'll need in your application then develop the database schema to store those objects. There is a lot of overlap between the two and once you've done one it should be easy for a tool to do the other. If you prefer to design starting from the objects and have the persistence handled for you, tools like Hibernate, are good for that.

I like to design the data model first. Database Management Systems are very sophisticated applications and in many cases often the bottleneck in an application. Designing the data model first helps me plan out how to best optimize for performance. This may or may not be true in all cases but I find it allows me to utilize the DBMS features as much as possible.

After spending a good deal of time on the data model, then I'd have to create objects to hold, read, and write to the tables. This was very tedious and repetitive work, even with some editor macros written to help speed things up so I started looking into other options. That's when I read an article on the DAO design pattern and started looking into DAO Generators.

There wasn't much in the way of open source solutions, and the commercial versions didn't do things exactly like I wanted them to do it so I started investigating what it would take to write my own. So I wrote a test class to connect to the DB and see what type of info I could extract. One thing led to another and I started generating source files. I wanted to see if they would work so I decided to use my DAO generator for a web project. As I was developing the project I kept making enhancements to the DAO generator. Then I was able to use it on another project and it made it a lot easier. Eventually I added a GUI front end to it.

Why open source MDAOG?
I read that most open source projects start because a developer has some sort of itch. My itch was that I wanted a way to speed up my web application development time by generating a lot of the JDBC code for me since I found it repetitive and boring. I'm hoping that others will find it as useful as I have and can contribute to it to make it better. It does every thing I need but there are some things I'd like it to do that I'm hoping others can help with. Such as support for multiple databases, plug in support for Netbeans and eclipse and generation of EJB jars as well as DAOs to access them.
Project News