sql2java: Object-Relational Mapping Tool for Java


Note: I haven't updated this project in a while. However, Florent Ramiere has started a SourceForge project based on this codebase. Check it out at: http://sql2java.sourceforge.net.

Overview

sql2java is a free, open source tool that enables Java developers to quickly map a relational database schema to a set of classes. These classes can be supplemented with your own methods and used within any Java application. The generated source code uses standard JDBC methods for persistence, and there is no runtime library required.

Mapping Philosophy

Different object-relational mapping tools have different philosophies about how to do the mapping. Some tools are very flexible, and allow you to combine fields from multiple tables to form a single class. Others don't generate source code, but instead rely on a configuration file, and generate dynamic SQL at runtime. sql2java takes a pretty simple approach to the problem. Each table is mapped to two different classes:

Requirements:


Examples


Notes

0.94 has added MySQL support. Testing was done with version 1.2c of the mm driver. Note that this driver (and our verison of MySQL - 3.21.29) do not support foreign keys, so the generated manager classes don't have the fancy load methods that classes generated against Oracle have. The StoreClientMysql class was written to reflect this (it doesn't call the non-existent methods).

To use s2j with MySQL, make sure your s2j.properties file contains:

writer=com.bitmechanic.sql2java.MysqlManagerWriter

Unlike the Oracle support, which I've tested on production code on a work related project, the MySQL support has only be tested with the StoreClientMysql class. Please let us know (using the eGroup below) if you experience problems with the MySQL support, as it may otherwise go undetected.

Unfortunately, I haven't been able to keep everything up to date. Here are the current problems:


Mailing List and Wiki

To discuss this project, visit our eGroups page: http://www.egroups.com/group/s2j.

There is also a Wiki for discussing this project.


Download

VersionRelease DateDownload Developer Docs
0.94July 6, 2000 tar.gz - zip HTML MS Word
0.93June 30, 2000 tar.gz - zip HTML MS Word
0.92April 15, 2000 tar.gz - zip HTML MS Word
0.91April 11, 2000 tar.gz - zip HTML MS Word
0.90March 4, 2000 tar.gz - zip HTML MS Word

NOTE: This software is distributed under the terms of the
GNU Public License. You are free to download, use, and modify this software under the terms of this license.


Related Projects

Here are links to other object relational mapping tools for Java:

Here are links to some articles about O-R mapping:


[ bitmechanic home ] [ projects ]