public void validateColumns(Dialect dialect, Mapping mapping, TableMetadata tableInfo) {Basicallly, when you use columnDefinition you have to use the lowercase, as following:
Iterator iter = getColumnIterator();
while ( iter.hasNext() ) {
Column col = (Column) iter.next();
ColumnMetadata columnInfo = tableInfo.getColumnMetadata( col.getName() );
if ( columnInfo == null ) {
throw new HibernateException( "Missing column: " + col.getName() + " in " + Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()));
}
else {
final boolean typesMatch = col.getSqlType( dialect, mapping )
.startsWith( columnInfo.getTypeName().toLowerCase() )
|| columnInfo.getTypeCode() == col.getSqlTypeCode( mapping );
if ( !typesMatch ) {
throw new HibernateException(
"Wrong column type: " + col.getName() +
", expected: " + col.getSqlType( dialect, mapping )
);
}
}
}
}
@Column(name = "xxxx", columnDefinition = "text", nullable = false)
and this won't work
@Column(name = "request_url", columnDefinition = "TEXT", nullable = false)The bug is in the red line that one part converted to lowercase, not another.
Just to be clkear, I have tried to post this on the hibernate forum but cannot register since I got all the code errors and timed out. so I gave up.