Package org.hibernate.dialect.type
Class DB2StructJdbcType
java.lang.Object
org.hibernate.dialect.type.DB2StructJdbcType
- All Implemented Interfaces:
Serializable,AggregateJdbcType,JdbcType,SqlTypedJdbcType,StructuredJdbcType
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.intA JDBC type code that identifies the SQL column type to be used for schema generation.intA 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) intThe 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, waitMethods 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, wrapWriteExpressionMethods inherited from interface org.hibernate.type.descriptor.jdbc.StructuredJdbcType
getSqlTypeName
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
DB2StructJdbcType
-
-
Method Details
-
getJdbcTypeCode
public int getJdbcTypeCode()Description copied from interface:JdbcTypeThe JDBC type code used when interacting with JDBC APIs.For example, it's used when calling
PreparedStatement.setNull(int, int).- Specified by:
getJdbcTypeCodein interfaceJdbcType- Returns:
- a JDBC type code
-
getDdlTypeCode
public int getDdlTypeCode()Description copied from interface:JdbcTypeA 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:
getDdlTypeCodein interfaceJdbcType- Returns:
- a JDBC type code
-
getDefaultSqlTypeCode
public int getDefaultSqlTypeCode()Description copied from interface:JdbcTypeA 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:
getDefaultSqlTypeCodein interfaceJdbcType- Returns:
- a JDBC type code
-
resolveAggregateJdbcType
public AggregateJdbcType resolveAggregateJdbcType(EmbeddableMappingType mappingType, String sqlType, RuntimeModelCreationContext creationContext) - Specified by:
resolveAggregateJdbcTypein interfaceAggregateJdbcType
-
getEmbeddableMappingType
- Specified by:
getEmbeddableMappingTypein interfaceAggregateJdbcType
-
getStructTypeName
- Specified by:
getStructTypeNamein interfaceStructuredJdbcType
-
getJdbcRecommendedJavaTypeMapping
public <T> JavaType<T> getJdbcRecommendedJavaTypeMapping(Integer precision, Integer scale, TypeConfiguration typeConfiguration) - Specified by:
getJdbcRecommendedJavaTypeMappingin interfaceJdbcType
-
getBinder
Description copied from interface:JdbcTypeObtain a binder object capable of binding values of the given Java type to parameters of a JDBCPreparedStatement. -
getExtractor
Description copied from interface:JdbcTypeObtain an extractor object capable of extracting values of the given Java type from a JDBCResultSet.- Specified by:
getExtractorin interfaceJdbcType- Parameters:
javaType- The descriptor describing the types of Java values to be extracted- Returns:
- The appropriate extractor
-
createJdbcValue
- Specified by:
createJdbcValuein interfaceAggregateJdbcType- Throws:
SQLException
-
extractJdbcValues
- Specified by:
extractJdbcValuesin interfaceAggregateJdbcType- Throws:
SQLException
-