« iCab 3.0.3 Beta 450 | Main | iCab 3.0.3 Beta 451 - Atomic »

Fri, Jun 01, 2007

Informix and Hibernate

While working on a Java web application that uses Hibernate as the persistence layer and Informix 10 as the database backend we discovered that Hibernate's built-in Informix dialect does not support BLOB and CLOB types.

Since Informix 10 supports these LOB types, it was easy to derive a new dialect from the existing one by simply adding the missing mappings:

  public class Informix10Dialect extends InformixDialect {
     public Informix10Dialect() {
        super();
        registerColumnType( Types.BLOB, "blob" );
        registerColumnType( Types.CLOB, "clob" );
     }
  }

This extended dialect works fine for us, and if you don't want to write it yourself, you can download a small archive here (provided "as is" without any warranties, use it at your own risk). Put the included JAR on your application's classpath and set the dialect in hibernate.properties as follows:

hibernate.dialect=de.snailshell.hibernate.Informix10Dialect

I've also posted a bug report for this issue, and once this is fixed, you won't need the extra dialect JAR any more.

Posted by Thomas Much at 13:43
Categories: Java