我正在使用NCHAR,NVARCHAR和NATIONAL VARCHAR。
http://dev.mysql.com/doc/refman/5.0/en/charset-national.html
我没有在MySqlDialect,MySql5INNODBDialect中找到上述数据类型的支持。
public MySQLDialect() {
super();
registerColumnType( Types.BIT, "bit" );
registerColumnType( Types.BIGINT, "bigint" );
registerColumnType( Types.SMALLINT, "smallint" );
registerColumnType( Types.TINYINT, "tinyint" );
registerColumnType( Types.INTEGER, "integer" );
registerColumnType( Types.CHAR, "char(1)" );
registerColumnType( Types.FLOAT, "float" );
registerColumnType( Types.DOUBLE, "double precision" );
registerColumnType( Types.DATE, "date" );
registerColumnType( Types.TIME, "time" );
registerColumnType( Types.TIMESTAMP, "datetime" );
registerColumnType( Types.VARBINARY, "longblob" );
registerColumnType( Types.VARBINARY, 16777215, "mediumblob" );
registerColumnType( Types.VARBINARY, 65535, "blob" );
registerColumnType( Types.VARBINARY, 255, "tinyblob" );
registerColumnType( Types.LONGVARBINARY, "longblob" );
registerColumnType( Types.LONGVARBINARY, 16777215, "mediumblob" );
registerColumnType( Types.NUMERIC, "decimal($p,$s)" );
registerColumnType( Types.BLOB, "longblob" );
// registerColumnType( Types.BLOB, 16777215, "mediumblob" );
// registerColumnType( Types.BLOB, 65535, "blob" );
registerColumnType( Types.CLOB, "longtext" );
// registerColumnType( Types.CLOB, 16777215, "mediumtext" );
// registerColumnType( Types.CLOB, 65535, "text" );
........
}
是否有任何hibernate方言支持Mysql UTF-8国家字符类型?
答案 0 :(得分:1)
在MySQL中没有这样的类型,它只是应用CHARACTER SET 'utf8'
的简写。
例如,写作NCHAR(10)
与写CHAR(10) CHARACTER SET 'utf8'
相同,它不是真正的类型。
您可以轻松配置连接和表格以使用utf8
开头,然后它就没有什么区别。