Hibernate version: 2.0
Name and version of the database you are using: PostgreSQL 8.2
We're having some issues in an Oracle 9i to PostgreSQL 8.2 transition. The project was done externally and has some libraries for which we lack sources... (that's why we don't have code, stacktraces and such)
Problems arise at the point of session updates, and we think they're due to boolean types. Database structure was unmodified, and boolean types are stored in numeric format (1 or 0, as Oracle treats them). As sources are mostly unmodified, postgresql dialect tries to use "bool" types in sqls and database expects numbers. We've tried to extend postgres dialect to change some values, but hibernate2 isn't as flexible as hib3 and the only option was to try a "registerColumnType". Code as follows:
public class SpecificPostgreSQLDialect extends PostgreSQLDialect {
public SpecificPostgreSQLDialect() {
super();
System.out.println("Instanced...");
registerColumnType( Types.BIT, "int2" );
getDefaultProperties().setPropertyEnvironment.QUERY_SUBSTITUTIONS, "true 1,false 0");
getDefaultProperties().setProperty(Environment.SHOW_SQL, "true");
}
}
This didn't work. Same symptoms.
Has anyone done a similar transition? How did you tackle the bool problem? Other workaround could involve a defined UserType for this boolean to int mapping. Any suggestions?
Thanks.
_________________ Please rate...
Expert on Hibernate errors... I've had them all... :P
|