Currently, I’m learning on how to incorporate iBatis into my application’s persistence layer. iBatis relies heavily on its xml files, which are used to map the SQLs to Java objects. If your project, contains a large number of tables, this could be a problem. You have to hand-code all the Java objects and SQLs manually. Being a self proclaimed Gung-Ho of open source technologies, I believe there must be something out there that could ease this burden. Well, there is!
There is a tool which was known as Abator, and was renamed to iBator. Wondering why changed the name? It was stated at the iBator web site, it was due to trade registration dispute. Well, changed name doesn’t affect the functionality at all. Functionally, iBator helps to generate the SQL Map Xmls and Java files based on the existing tables. Not only that, it could also generates DAO layer for you. It could tailor your DAO layer according to the Spring DAO standards. All you need to do after this, is tweak a bit on the generated xml files and connect your service layer to the DAO layer. How’s that for a speed in your project.
Basically, you will need one jar file, iBator jar. It doesn’t has any dependencies. But in my case, I would need ant jar file, since I’m using ant to execute the generator.
First, I would need the abatorConfig.xml file. Below is how I set the database connection settings:

Then, there are 3 items I’m setting below. First element, is the Java objects’ settings. Second element, is the SQLs xml files’ settings. And the third element, is the DAOs settings. Here you have to specify the target locations and the package/folder names for the generated files.

Third, is my tables settings. Here I mapped the tables to my Java objects:

Lastly, I just need to execute below ant file:

That’s it. After running above ant build, you would have the almost complete DAO layer for your application. Some extra work might be needed such as configuring your tables relationship, setting your SQLMapConfig, and connecting your DAO layer to your service layer.
As with any other generator utility, it won’t gives you the perfect generated files. Some level of tweaking is expected from you. But to kick start a project with lots of tables, for sure you could appreciate the benefits of this utility.