Tuesday, July 11, 2006

 

Modelling a data schema from scratch.

(These are just some musings on how one should go about modelling data. I'm sure many other projects have had similar considerations to make!)

In our project we have had the "luxury" of being able to design our data schema from scratch. In other words, we have not been given a data schema that we have to match. However, I think it's interesting to see the forces at work and know where to focus one's energies. For instance, as this is a 'web service' we've always known that there was going to be an associated schema, in this case, XML schema (although equally we could have used DTD or Relax NG). However, we've also known that the data has to be persisted some how. Therefore, we could have concentrated on the (relational) schema of the database. However, as it is, because I was particularly keen to abstract persistence away, it made sense to concentrate on the XML schema itself. By doing this we could have even used an XML database such as eXist. By opting to use JDO with JPOX, this actually generates the relational schema for us from the persistence-capable classes that we specify (which in turn, were JAXB classes generated from an XML schema!). However, you can still work in reverse; if we'd had an existing relational schema, we could add directives in the package.jdo file to specify how we wanted the properties of classes to map to columns in tables. (We do have some directives in fact; we have to specify how Java enums get mapped to columns as the JDO JCP have not agreed on how to standardize this yet!). So, intriguing things to ponder. I guess what it boils down to is you use whatever "schema" language (relational database, XML schema, etc) that you feel most comfortable with.

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?