Question

I am using NCHAR, NVARCHAR and NATIONAL VARCHAR.

http://dev.mysql.com/doc/refman/5.0/en/charset-national.html

I didn't find the support in MySqlDialect, MySql5INNODBDialect for the above data type.

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" );
    ........
}

Is there any hibernate dialect to support Mysql UTF-8 National Character Type?

Was it helpful?

Solution

There is no such type in MySQL, it is just a short-hand for applying CHARACTER SET 'utf8'.

For example writing NCHAR(10) is same as writing CHAR(10) CHARACTER SET 'utf8', it's not a real type.

You can easily just configure your connection and tables to use utf8 to begin with and then it doesn't make a difference.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top