Update H2 to 2.1.210 and HSQLDB to 2.6.1

This commit is contained in:
Christian Beikov 2022-03-18 12:07:53 +01:00
parent b737231416
commit e1742ac3ac
3 changed files with 24 additions and 10 deletions

View File

@ -13,7 +13,10 @@ ext {
junitVintageVersion = '5.8.2'
junit5Version = '5.8.2'
h2Version = '1.4.197'
h2Version = '2.1.210'
h2GisVersion = '2.0.0'
// h2Version = '1.4.197'
// h2GisVersion = '1.5.0'
bytemanVersion = '4.0.16' //Compatible with JDK16
jnpVersion = '5.0.6.CR1'
@ -151,8 +154,8 @@ ext {
byteman_install: "org.jboss.byteman:byteman-install:${bytemanVersion}",
byteman_bmunit: "org.jboss.byteman:byteman-bmunit:${bytemanVersion}",
h2: "com.h2database:h2:${h2Version}",
h2gis: "org.orbisgis:h2gis:1.5.0",
hsqldb: "org.hsqldb:hsqldb:2.3.6",
h2gis: "org.orbisgis:h2gis:${h2GisVersion}",
hsqldb: "org.hsqldb:hsqldb:2.6.1",
derby: "org.apache.derby:derby:10.14.2.0",
postgresql: 'org.postgresql:postgresql:42.2.16',
mysql: 'mysql:mysql-connector-java:8.0.27',

View File

@ -178,11 +178,7 @@ public class H2Dialect extends Dialect {
case NCHAR:
return columnType( CHAR );
case NVARCHAR:
case LONG32NVARCHAR:
case LONG32VARCHAR:
return columnType( VARCHAR );
case LONG32VARBINARY:
return columnType( VARBINARY );
}
return super.columnType( sqlTypeCode );
}
@ -235,7 +231,7 @@ public class H2Dialect extends Dialect {
jdbcTypeRegistry.addDescriptorIfAbsent( UUIDJdbcType.INSTANCE );
}
if ( getVersion().isSameOrAfter( 1, 4, 198 ) ) {
jdbcTypeRegistry.addDescriptorIfAbsent( DurationIntervalSecondJdbcType.INSTANCE );
jdbcTypeRegistry.addDescriptorIfAbsent( H2DurationIntervalSecondJdbcType.INSTANCE );
}
}

View File

@ -26,9 +26,9 @@ import org.hibernate.type.descriptor.jdbc.JdbcType;
/**
* @author Christian Beikov
*/
public class DurationIntervalSecondJdbcType implements JdbcType {
public class H2DurationIntervalSecondJdbcType implements JdbcType {
public static final DurationIntervalSecondJdbcType INSTANCE = new DurationIntervalSecondJdbcType();
public static final H2DurationIntervalSecondJdbcType INSTANCE = new H2DurationIntervalSecondJdbcType();
@Override
public int getJdbcTypeCode() {
@ -74,17 +74,32 @@ public class DurationIntervalSecondJdbcType implements JdbcType {
return new BasicExtractor<>( javaType, this ) {
@Override
protected X doExtract(ResultSet rs, int paramIndex, WrapperOptions options) throws SQLException {
// Handle the fact that a duration could also come as number of nanoseconds
final Object nativeValue = rs.getObject( paramIndex );
if ( nativeValue instanceof Number ) {
return javaType.wrap( nativeValue, options );
}
return javaType.wrap( rs.getObject( paramIndex, Duration.class ), options );
}
@Override
protected X doExtract(CallableStatement statement, int index, WrapperOptions options) throws SQLException {
// Handle the fact that a duration could also come as number of nanoseconds
final Object nativeValue = statement.getObject( index );
if ( nativeValue instanceof Number ) {
return javaType.wrap( nativeValue, options );
}
return javaType.wrap( statement.getObject( index, Duration.class ), options );
}
@Override
protected X doExtract(CallableStatement statement, String name, WrapperOptions options)
throws SQLException {
// Handle the fact that a duration could also come as number of nanoseconds
final Object nativeValue = statement.getObject( name );
if ( nativeValue instanceof Number ) {
return javaType.wrap( nativeValue, options );
}
return javaType.wrap( statement.getObject( name, Duration.class ), options );
}
};