XSD Compilers
I am a big fan of XML Schema Definition (XSD) as a method of defining a data model. Generating from an XSD compiler has two benefits: you get XML marshalling for free and though XSD is a rather bureaucratic language, it is object oriented and thus quite close to implementation languages like Java and C#. Once the model is generated by the XSD compiler, it is a simple task to add persistence to the generated POJOs using Hibernate or JPA mapping files.
The alternative of defining a data model using SQL DDL and then generating Java classes using the Hibernate tools might be better in a project where data reporting is key; however you then have the problem of how to graft on XML marshalling.
Use of an XSD compiler saves masses of development time; one can play around with the data model and regenerate it at the press of button; crucially it is easy to get the gist of an application without wading through lots of code.
Java XSD compilers
Java has numerous XSD compilers such as XMLBeans.
My preferred XSD compiler is Castor:
- it has been around for ages.
- it is well supported.
- it produces pretty reasonable code.
- the generated code can easily be integrated with a persistence layer (e.g. Hibernate/JPA3), a service layer (e.g. Spring Webservices) and a user interface (e.g. GWT).