In looking at integrating JForum with our software, I've developed a DAO implimentation based on the Apache Torque OM layer (
http://db.apache.org/torque ). Would the jForum team be interested in having this contributed to the project?
I've tested all the basic functions against MySQL and it seems to be working find. I'm getting ready to try it against MS SQL. FWIW, I need MS SQL support, so I started to debug the existing MS SQL DAO. But since I'm a long time user, supporter, contributer to the Torque project, I decided to go this route.
Here's some info on Torque:
Torque is an object-relational mapper for
java. In other words, Torque lets you access and manipulate data in a relational database using java objects. Unlike most other object-relational mappers, Torque does not use reflection to access user-provided classes, but it generates the necessary classes (including the Data Objects) from an XML schema describing the database layout. The XML schema can also be used to generate and execute a SQL script which creates all the tables in the database.
What this means is that:
I've modeled the jForum DB schema into Torque's XML format. This was used to generate a set of OM objects that were used with Torque's generic
Criteria functions to create the DAO. In theory, this should allow jForum to run with on any of the 18 relational databases that Torque supports.
In addition, Torque can use the Schema XML to generate SQL scripts to create the schema for any of it's supported DBs via an
Ant (or Maven) target. Just set the build properties to the DB you want, call the Torque sql target, and you get a DB specific script for table generation.
Modifying the schema become a simple matter of changing the XML, regenerating the OM objects, changing a single DAO to use the new table/columns, and then regenerating the database build scripts.
(Ok, I admit, I'm a Torque-a-holic...)
There are some warts here and there, but this seems like a good enhancement for jForum... and I like contributing to open source projects.
Greg
[originally posted on jforum.net by monroe]