0

我正在使用 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 National Character Type?

4

1 回答 1

1

MySQL 中没有这种类型,它只是应用的简写CHARACTER SET 'utf8'

例如 writingNCHAR(10)与 writing 相同CHAR(10) CHARACTER SET 'utf8',它不是真正的类型。

您可以轻松地配置您的连接和表以utf8开始使用,然后它不会产生任何影响。

于 2013-02-22T07:22:44.367 回答