Hi,
I have a problem with defining custom mapping for a column. I want to define a custom column for Unicode strings, so I extended StringType as StringType2, and overrided getName to return "string2". I also extended Oracle10gDialect as follows to register my new type with code -999:
Code:
public class MyOracle10gDialect extends Oracle10gDialect {
public MyOracle10gDialect() {
registerHibernateType(-999, new HibernateString2().getName());
}
protected void registerCharacterTypeMappings() {
super.registerCharacterTypeMappings();
registerColumnType(-999, 255, "nvarchar2($l)");
}
}
I added a @Type(type="string2") to a field in an entity which should hold nvarchar2 (Unicode) data.
Hibernate fails to create EntityManagerFactory because of the line @Type(type="string2"). I traced the problem and found that MyOracle10gDialect is never instantiated, so Hibernate doesn't understand what is string2. This is definitely a load-time-order issue, so how can I register my custom type before hibernate checks for @Type?
BTW, I'm using Hibernate 3.2.5.GA along with Spring 2.5 and Oracle 10g.
Mohsen.