Looks to be a bug in the OverrideRepository.getPreferredHibernateType method and the TypeMappingKey inner class. The TypeMappingKey has no references to precision and scale, only length, so precision and scale will never be analyzed for matches in the reveng file.
As a workaround for now, implement the columnToHibernateTypeName method in a custom Strategy class thusly:
Code:
public class Strategy extends DelegatingReverseEngineeringStrategy {
@Override
public String columnToHibernateTypeName(TableIdentifier table,
String columnName, int sqlType, int length, int precision,
int scale, boolean nullable, boolean generatedIdentifier) {
// Generate column mappings as Integer if the column type is SMALLINT and the precision is 2
if ((sqlType == java.sql.Types.SMALLINT ) && (precision == 2)) {
return "java.lang.Integer";
} else {
return super.columnToHibernateTypeName(table, columnName, sqlType,
length, precision, scale, nullable, generatedIdentifier);
}
}
}