Fix MariaDB, DB2 and Derby column type for text type attributes

This commit is contained in:
Andrea Boriero 2021-04-07 16:05:25 +02:00
parent 6f42929b55
commit ae69a1aeb4
4 changed files with 15 additions and 1 deletions

View File

@ -110,6 +110,8 @@ public DB2Dialect(int version) {
registerColumnType( Types.TIMESTAMP_WITH_TIMEZONE, "timestamp($p)" );
registerColumnType( Types.TIME_WITH_TIMEZONE, "time" );
registerColumnType( Types.LONGVARCHAR, "long varchar" );
//not keywords, at least not in DB2 11,
//but perhaps they were in older versions?
registerKeyword( "current" );

View File

@ -119,6 +119,8 @@ public DerbyDialect(int version) {
registerColumnType( Types.TIMESTAMP, "timestamp" );
registerColumnType( Types.TIMESTAMP_WITH_TIMEZONE, "timestamp" );
registerColumnType( Types.LONGVARCHAR, "long varchar" );
registerDerbyKeywords();
limitHandler = getVersion() < 1050

View File

@ -6,6 +6,8 @@
*/
package org.hibernate.dialect;
import java.sql.Types;
import org.hibernate.dialect.sequence.MariaDBSequenceSupport;
import org.hibernate.dialect.sequence.SequenceSupport;
import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo;
@ -43,6 +45,10 @@ public MariaDBDialect(int version) {
this.version = version;
}
protected int getMaxVarcharLen() {
return getMySQLVersion() < 500 ? 255 : 65_534;
}
@Override
public int getVersion() {
return version;

View File

@ -117,7 +117,7 @@ else if( "myisam".equalsIgnoreCase( storageEngine ) ) {
}
// max length for VARCHAR changed in 5.0.3
final int maxVarcharLen = getMySQLVersion() < 500 ? 255 : 65_535;
final int maxVarcharLen = getMaxVarcharLen();
registerColumnType( Types.VARCHAR, maxVarcharLen, "varchar($l)" );
registerColumnType( Types.VARBINARY, maxVarcharLen, "varbinary($l)" );
@ -187,6 +187,10 @@ public Size resolveSize(
};
}
protected int getMaxVarcharLen() {
return getMySQLVersion() < 500 ? 255 : 65_535;
}
@Override
public int getVersion() {
return version;