Hi,
MySQL doesn't like VARCHAR(n) with n > 255. For Strings,
one has to use type TEXT, for bytes, one has to use BLOB
(both without length specification). To make things work, I
added the following Code to MySQLDialect:
public String getTypeName(int code, int length) throws
HibernateException {
switch (code) {
case Types.VARCHAR:
if (length > 255)
return "TEXT";
break;
case Types.VARBINARY:
if (length > 255)
return "BLOB";
break;
}
return super.getTypeName(code, length);
}
I know this is somewhat ugly code. Any suggestions about that?
Incorporate such a hack or find a more general way to do it?
The question here is: do we expect type name patterns to be
length-dependent for other dialects, too?
Regards, Christoph
|