In RHQ ( http://rhq-project.org/ ) we have some dbutils that have a schema description in XML, which serves to populate the initial schema with an empty database, and then another XML file that records changes to this basic schema as separate "differences" of DDL and DML operators.
Whenever the JPA class changes (in the appropriate schema), both XML files are updated. At the next launch of the installer, he will search for the existing database, collect its version and then play all the stages of updating from the version in the database to the latest.
This dbutils code is available in git .
There are other frameworks like liquibase that can help you.
Heiko rupp
source share