Tuesday, April 15, 2008

Oracle CHAR(10) and Hibernate

Had a problem today with the Oracle database where the table was defined with a column of datatype CHAR(10) . The application was connecting to the database through hibernate and the hibernate mappings had a definition of String for this column

<class name="blah" table="BLAH_IN">
<property name="test" type="string" column="TEST">

where the table was
( "TEST" CHAR(10 BYTE));

Searches using the Criteria in hibernate for this field would not return a result because of the type difference. hence I had to create a UserType

The creation of this is well documeted in


Saved my day