So I've started looking at the persistence mechanism for my feed reader.I thought about Jisp, like Rickard suggested, but I can just see wanting to do too many different kinds of queries (show me the items since xxx in channel yyy). Maybe it's just my RDBMS bias, or the fact that I KNOW how to do that stuff with a database,but I couldn't see a better way than a relational database.
So then it comes down to WHICH database to use. The natural, default answer to an embedded, fast, java database was obviously hsqldb. I hadn't looked at it in a while, and was never particularly familiar with its syntax, so I started reading up on it so I could start building the DDL. As I'm reading through the docs and trying to cobble together the "CREATE TABLE..." statements, I thought about the stuff I had read from James Strachan about Jakarta Commons SQL.With it, you can define your database model in an XML file, and use the Ant task to build your DDL for one of many different databases (Oracle, SQL Server,DB2, Hsqldb, Axion, ...).
So, long story short, I probably spent less time building the XML file (whichis much easier to read and understandthan DDL) and about 20 seconds (literally) to put the ant task into my build.xml,and voila, I've got my DDL for hsqldb, but I can easily create the same for almost any other RDBMS.
Next up, building the Castor mappingfile...
Edited with Composite
:-). Glad you liked it. Generating other stuff from your XML file should be trivial; like the Castor mapping file or beans to map 1-1 to your relational model. Just use the commons-sql beans with Velocity or Jelly etc.
BTW I don't think I'd recommend hsqldb to anyone unless its just for temporary data used by unit test cases. It only stores the statements executed, not the data. So startup time can take a long time if you use it for more than a day.