HHH-18316 use utf8mb4 instead of utf8 for NCHAR/NVARCHAR on MySQL
Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
83643af8d0
commit
4ce4ccb1bd
|
@ -275,15 +275,15 @@ public class MySQLDialect extends Dialect {
|
||||||
|
|
||||||
// on MySQL 8, the nchar/nvarchar types use a deprecated character set
|
// on MySQL 8, the nchar/nvarchar types use a deprecated character set
|
||||||
case NCHAR:
|
case NCHAR:
|
||||||
return "char($l) character set utf8";
|
return "char($l) character set utf8mb4";
|
||||||
case NVARCHAR:
|
case NVARCHAR:
|
||||||
return "varchar($l) character set utf8";
|
return "varchar($l) character set utf8mb4";
|
||||||
|
|
||||||
// the maximum long LOB length is 4_294_967_295, bigger than any Java string
|
// the maximum long LOB length is 4_294_967_295, bigger than any Java string
|
||||||
case BLOB:
|
case BLOB:
|
||||||
return "longblob";
|
return "longblob";
|
||||||
case NCLOB:
|
case NCLOB:
|
||||||
return "longtext character set utf8";
|
return "longtext character set utf8mb4";
|
||||||
case CLOB:
|
case CLOB:
|
||||||
return "longtext";
|
return "longtext";
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ public class MySQLDialect extends Dialect {
|
||||||
case NCHAR:
|
case NCHAR:
|
||||||
case NVARCHAR:
|
case NVARCHAR:
|
||||||
case LONG32NVARCHAR:
|
case LONG32NVARCHAR:
|
||||||
return "char character set utf8";
|
return "char character set utf8mb4";
|
||||||
case BINARY:
|
case BINARY:
|
||||||
case VARBINARY:
|
case VARBINARY:
|
||||||
case LONG32VARBINARY:
|
case LONG32VARBINARY:
|
||||||
|
@ -382,10 +382,10 @@ public class MySQLDialect extends Dialect {
|
||||||
castType( NCHAR ),
|
castType( NCHAR ),
|
||||||
this
|
this
|
||||||
)
|
)
|
||||||
.withTypeCapacity( getMaxVarcharLength(), "varchar($l) character set utf8" )
|
.withTypeCapacity( getMaxVarcharLength(), "varchar($l) character set utf8mb4" )
|
||||||
.withTypeCapacity( maxMediumLobLen, "mediumtext character set utf8" );
|
.withTypeCapacity( maxMediumLobLen, "mediumtext character set utf8mb4" );
|
||||||
if ( getMaxVarcharLength() < maxLobLen ) {
|
if ( getMaxVarcharLength() < maxLobLen ) {
|
||||||
nvarcharBuilder.withTypeCapacity( maxLobLen, "text character set utf8" );
|
nvarcharBuilder.withTypeCapacity( maxLobLen, "text character set utf8mb4" );
|
||||||
}
|
}
|
||||||
ddlTypeRegistry.addDescriptor( nvarcharBuilder.build() );
|
ddlTypeRegistry.addDescriptor( nvarcharBuilder.build() );
|
||||||
|
|
||||||
|
@ -433,9 +433,9 @@ public class MySQLDialect extends Dialect {
|
||||||
ddlTypeRegistry.addDescriptor(
|
ddlTypeRegistry.addDescriptor(
|
||||||
CapacityDependentDdlType.builder( NCLOB,
|
CapacityDependentDdlType.builder( NCLOB,
|
||||||
columnType( NCLOB ), castType( NCHAR ), this )
|
columnType( NCLOB ), castType( NCHAR ), this )
|
||||||
.withTypeCapacity( maxTinyLobLen, "tinytext character set utf8" )
|
.withTypeCapacity( maxTinyLobLen, "tinytext character set utf8mb4" )
|
||||||
.withTypeCapacity( maxMediumLobLen, "mediumtext character set utf8" )
|
.withTypeCapacity( maxMediumLobLen, "mediumtext character set utf8mb4" )
|
||||||
.withTypeCapacity( maxLobLen, "text character set utf8" )
|
.withTypeCapacity( maxLobLen, "text character set utf8mb4" )
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue