martes, 17 de junio de 2008

Java Hibernate Migrations -- 2nd. try

Immediately after I wrote my previous post I spent some more time with liquibase.org and they do have a scape tag, which makes it a lot more attractive as it supports branches, rollbacks , database documentation and so on.

The process would stay similar to my first post but now being liquibase the "golden" repository for DB DDL.

Here are key points I see when using liquibase:
  1. You must have a really good XSD Editor for creating the files. You can use www.JEdit.org for this, one of the BEST editors I have seen for XSD based XML documents
  2. Use the liquibase core directly or maybe ant to take advantage of the new updates. Ant, maven, IDE may be out of date with old versions
  3. Make yourself a favor and watch the long webcast that shows liquibase capabilities

It seems these liquibase guys have done a great job, I will post more later.

Cheers!

Java Hibernate Migrations

Inspired by a post by Hari in one of his posts he mentions database migration tools and I took a look at the ones he mentioned, specially Liquibase and migrate4j.

I also found an alternative I was more attracted to Java DB Migrations because of its simplicity and possibilities to interface to my selected persistence framework: hibernate.

Roughly the steps I am thinking of are:

  1. Do most of the Object Model to be persisted in Hibernate Annotations
  2. Fine tune in Hibernate XML files
  3. Generate the initial DDL using Hibernate
  4. Fine tune that DDL manually to make it the initial (001) migration
  5. Continue maintaining DDL in parallel to your hibernate code
  6. If you ever need to migrate to a different database, use the sql migration code as a base line
I would very much like to hear if anyone knows about a Hibernate (3) migrations framework that you like as this is a kind of a patch I found.

Have fun!

Intention

This blog is intended to share random thoughts about software development in different areas. Initial areas include:

  • Database development
  • Java development
  • SOA Java development