HHH-18446 Added default SQL type code to LongVarbinaryJdbcType abd LongVarcharJdbcType

This commit is contained in:
Čedomir Igaly 2024-08-06 15:54:55 +02:00 committed by Gavin King
parent b5b195740b
commit bdc0070d97
3 changed files with 25 additions and 15 deletions

View File

@ -14,14 +14,19 @@ import java.sql.Types;
public class LongVarbinaryJdbcType extends VarbinaryJdbcType { public class LongVarbinaryJdbcType extends VarbinaryJdbcType {
public static final LongVarbinaryJdbcType INSTANCE = new LongVarbinaryJdbcType(); public static final LongVarbinaryJdbcType INSTANCE = new LongVarbinaryJdbcType();
private final int jdbcTypeCode; private final int defaultSqlTypeCode;
public LongVarbinaryJdbcType() { public LongVarbinaryJdbcType() {
this(Types.LONGVARBINARY); this( Types.LONGVARBINARY );
} }
public LongVarbinaryJdbcType(int jdbcTypeCode) { public LongVarbinaryJdbcType(int defaultSqlTypeCode) {
this.jdbcTypeCode = jdbcTypeCode; this.defaultSqlTypeCode = defaultSqlTypeCode;
}
@Override
public int getDefaultSqlTypeCode() {
return defaultSqlTypeCode;
} }
@Override @Override
@ -31,6 +36,6 @@ public class LongVarbinaryJdbcType extends VarbinaryJdbcType {
@Override @Override
public int getJdbcTypeCode() { public int getJdbcTypeCode() {
return jdbcTypeCode; return Types.LONGVARBINARY;
} }
} }

View File

@ -4,13 +4,13 @@
*/ */
package org.hibernate.type.descriptor.jdbc; package org.hibernate.type.descriptor.jdbc;
import java.sql.Types;
import org.hibernate.type.SqlTypes; import org.hibernate.type.SqlTypes;
import org.hibernate.type.descriptor.java.JavaType; import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
import java.sql.Types;
/** /**
* Descriptor for {@link Types#LONGVARCHAR LONGVARCHAR} handling. * Descriptor for {@link Types#LONGVARCHAR LONGVARCHAR} handling.
* *
@ -19,14 +19,14 @@ import org.hibernate.type.spi.TypeConfiguration;
public class LongVarcharJdbcType extends VarcharJdbcType { public class LongVarcharJdbcType extends VarcharJdbcType {
public static final LongVarcharJdbcType INSTANCE = new LongVarcharJdbcType(); public static final LongVarcharJdbcType INSTANCE = new LongVarcharJdbcType();
private final int jdbcTypeCode; private final int defaultSqlTypeCode;
public LongVarcharJdbcType() { public LongVarcharJdbcType() {
this(Types.LONGVARCHAR); this( Types.LONGVARCHAR );
} }
public LongVarcharJdbcType(int jdbcTypeCode) { public LongVarcharJdbcType(int defaultSqlTypeCode) {
this.jdbcTypeCode = jdbcTypeCode; this.defaultSqlTypeCode = defaultSqlTypeCode;
} }
@Override @Override
@ -36,7 +36,12 @@ public class LongVarcharJdbcType extends VarcharJdbcType {
@Override @Override
public int getJdbcTypeCode() { public int getJdbcTypeCode() {
return jdbcTypeCode; return Types.LONGVARCHAR;
}
@Override
public int getDefaultSqlTypeCode() {
return defaultSqlTypeCode;
} }
@Override @Override

View File

@ -85,12 +85,12 @@ public class JdbcTypeBaseline {
target.addDescriptor( BinaryJdbcType.INSTANCE ); target.addDescriptor( BinaryJdbcType.INSTANCE );
target.addDescriptor( VarbinaryJdbcType.INSTANCE ); target.addDescriptor( VarbinaryJdbcType.INSTANCE );
target.addDescriptor( LongVarbinaryJdbcType.INSTANCE ); target.addDescriptor( LongVarbinaryJdbcType.INSTANCE );
target.addDescriptor( new LongVarbinaryJdbcType(SqlTypes.LONG32VARBINARY) ); target.addDescriptor( new LongVarbinaryJdbcType( SqlTypes.LONG32VARBINARY) );
target.addDescriptor( CharJdbcType.INSTANCE ); target.addDescriptor( CharJdbcType.INSTANCE );
target.addDescriptor( VarcharJdbcType.INSTANCE ); target.addDescriptor( VarcharJdbcType.INSTANCE );
target.addDescriptor( LongVarcharJdbcType.INSTANCE ); target.addDescriptor( LongVarcharJdbcType.INSTANCE );
target.addDescriptor( new LongVarcharJdbcType(SqlTypes.LONG32VARCHAR) ); target.addDescriptor( new LongVarcharJdbcType( SqlTypes.LONG32VARCHAR) );
target.addDescriptor( BlobJdbcType.DEFAULT ); target.addDescriptor( BlobJdbcType.DEFAULT );
target.addDescriptor( ClobJdbcType.DEFAULT ); target.addDescriptor( ClobJdbcType.DEFAULT );
@ -101,7 +101,7 @@ public class JdbcTypeBaseline {
target.addDescriptor( Types.NVARCHAR, VarcharJdbcType.INSTANCE ); target.addDescriptor( Types.NVARCHAR, VarcharJdbcType.INSTANCE );
target.addDescriptor( Types.LONGNVARCHAR, LongVarcharJdbcType.INSTANCE ); target.addDescriptor( Types.LONGNVARCHAR, LongVarcharJdbcType.INSTANCE );
target.addDescriptor( Types.NCLOB, ClobJdbcType.DEFAULT ); target.addDescriptor( Types.NCLOB, ClobJdbcType.DEFAULT );
target.addDescriptor( new LongVarcharJdbcType(SqlTypes.LONG32NVARCHAR) ); target.addDescriptor( new LongVarcharJdbcType( SqlTypes.LONG32NVARCHAR) );
target.addDescriptor( RowIdJdbcType.INSTANCE ); target.addDescriptor( RowIdJdbcType.INSTANCE );
} }