Package org.hibernate.dialect
Class DB2StructJdbcType
java.lang.Object
org.hibernate.dialect.DB2StructJdbcType
- All Implemented Interfaces:
Serializable
,AggregateJdbcType
,JdbcType
,SqlTypedJdbcType
,StructJdbcType
DB2 supports UDTs but not in JDBC, so there is a feature called "transforms",
which allows to specify an automatic translation from one data type to another.
To support UDTs, we require that a transform exists for the UDT that serializes from SQL to XML
and deserializes to SQL from UDT. This means that from the JDBC perspective, this is an XML type,
but the database models it internally as UDT.
The DB2AggregateSupport
generates the functions and transforms for this
process automatically, but note that all of this is only used for functions and native queries.
By default, we select individual struct parts to avoid the encoding/decoding.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDB2StructJdbcType
(EmbeddableMappingType embeddableMappingType, String structTypeName) -
Method Summary
Modifier and TypeMethodDescriptioncreateJdbcValue
(Object value, WrapperOptions options) Object[]
extractJdbcValues
(Object rawJdbcValue, WrapperOptions options) <X> ValueBinder<X>
Obtain a binder object capable of binding values of the given Java type to parameters of a JDBCPreparedStatement
.int
A JDBC type code that identifies the SQL column type to be used for schema generation.int
A JDBC type code that identifies the SQL column type.<X> ValueExtractor<X>
getExtractor
(JavaType<X> javaType) <T> JavaType<T>
getJdbcRecommendedJavaTypeMapping
(Integer precision, Integer scale, TypeConfiguration typeConfiguration) int
The JDBC type code used when interacting with JDBC APIs.resolveAggregateJdbcType
(EmbeddableMappingType mappingType, String sqlType, RuntimeModelCreationContext creationContext) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.hibernate.type.descriptor.jdbc.JdbcType
addAuxiliaryDatabaseObjects, appendWriteExpression, getCastType, getCheckCondition, getExtraCreateTableInfo, getFriendlyName, getJdbcLiteralFormatter, getPreferredJavaTypeClass, hasDatePart, hasTimePart, isArray, isBinary, isBoolean, isComparable, isDecimal, isDuration, isFloat, isImplicitJson, isImplicitXml, isInteger, isInterval, isJson, isLob, isLobOrLong, isNationalized, isNumber, isSmallInteger, isSpatial, isString, isStringLike, isStringLikeExcludingClob, isTemporal, isXml, registerOutParameter, registerOutParameter, wrapTopLevelSelectionExpression, wrapWriteExpression
Methods inherited from interface org.hibernate.type.descriptor.jdbc.StructJdbcType
getSqlTypeName
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
DB2StructJdbcType
-
-
Method Details
-
getJdbcTypeCode
public int getJdbcTypeCode()Description copied from interface:JdbcType
The JDBC type code used when interacting with JDBC APIs.For example, it's used when calling
PreparedStatement.setNull(int, int)
.- Specified by:
getJdbcTypeCode
in interfaceJdbcType
- Returns:
- a JDBC type code
-
getDdlTypeCode
public int getDdlTypeCode()Description copied from interface:JdbcType
A JDBC type code that identifies the SQL column type to be used for schema generation.This value is passed to
DdlTypeRegistry.getTypeName(int, Size, Type)
to obtain the SQL column type.- Specified by:
getDdlTypeCode
in interfaceJdbcType
- Returns:
- a JDBC type code
-
getDefaultSqlTypeCode
public int getDefaultSqlTypeCode()Description copied from interface:JdbcType
A JDBC type code that identifies the SQL column type.This value might be different from
JdbcType.getDdlTypeCode()
if the actual type e.g. JSON is emulated through a type like CLOB.- Specified by:
getDefaultSqlTypeCode
in interfaceJdbcType
- Returns:
- a JDBC type code
-
resolveAggregateJdbcType
public AggregateJdbcType resolveAggregateJdbcType(EmbeddableMappingType mappingType, String sqlType, RuntimeModelCreationContext creationContext) - Specified by:
resolveAggregateJdbcType
in interfaceAggregateJdbcType
-
getEmbeddableMappingType
- Specified by:
getEmbeddableMappingType
in interfaceAggregateJdbcType
-
getStructTypeName
- Specified by:
getStructTypeName
in interfaceStructJdbcType
-
getJdbcRecommendedJavaTypeMapping
public <T> JavaType<T> getJdbcRecommendedJavaTypeMapping(Integer precision, Integer scale, TypeConfiguration typeConfiguration) - Specified by:
getJdbcRecommendedJavaTypeMapping
in interfaceJdbcType
-
getBinder
Description copied from interface:JdbcType
Obtain a binder object capable of binding values of the given Java type to parameters of a JDBCPreparedStatement
. -
getExtractor
Description copied from interface:JdbcType
Obtain an extractor object capable of extracting values of the given Java type from a JDBCResultSet
.- Specified by:
getExtractor
in interfaceJdbcType
- Parameters:
javaType
- The descriptor describing the types of Java values to be extracted- Returns:
- The appropriate extractor
-
createJdbcValue
- Specified by:
createJdbcValue
in interfaceAggregateJdbcType
- Throws:
SQLException
-
extractJdbcValues
- Specified by:
extractJdbcValues
in interfaceAggregateJdbcType
- Throws:
SQLException
-