Hi!
I'm currently having some trouble deploying a Hibernate-based application on top of Informix 7.31. First, as Hibernate seems to only ship a dialect for Informix 9.x and above out-of-the-box, I had to write my own Informix7Dialect in order to make things work:
Code:
package com.kesselheim.hibernatedemo;
import java.sql.Types;
import org.hibernate.MappingException;
import org.hibernate.dialect.InformixDialect;
public class Informix7Dialect extends InformixDialect {
public InformixDialect(){
super();
registerColumnType(Types.BIGINT, "int");
registerColumnType(Types.CLOB, "text");
registerColumnType(Types.TIMESTAMP, "datetime year to second");
}
public String getIdentityColumnString() throws MappingException {
return "serial not null";
}
}
Using that dialect, I'm able to deploy my application (using hibernate) on Informix 7.31 (hibernate even generated the correct table structure on the fly).
Another problem comes into play when running on a (pre-defined) DB schema with discriminator columns beeing of type char(20), as Informix happens to always return a String of size 20 in its ResultSet, regardless how many (non-whitespace) characters were actually in there. My question therefore: Is it possible to adapt the dialect (or whatever class there is, perhaps by overloading StringType and making it the default mapping for java.lang.String?) so that all String values are trimmed before they're given back to my hibernate application?
Best regards,
Chris