mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-03-01 15:29:11 +00:00
Fix MariaDB, DB2 and Derby column type for text type attributes
This commit is contained in:
parent
6f42929b55
commit
ae69a1aeb4
@ -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" );
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user