Interface JdbcType
-
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
AdjustableJdbcType
- All Known Implementing Classes:
AbstractHANADialect.HANABlobType,ArrayJdbcType,BigIntJdbcType,BinaryJdbcType,BlobJdbcType,BooleanJdbcType,CharJdbcType,ClobJdbcType,DateJdbcType,DecimalJdbcType,DoubleJdbcType,FloatJdbcType,H2DurationIntervalSecondJdbcType,InstantAsTimestampJdbcType,InstantAsTimestampWithTimeZoneJdbcType,InstantJdbcType,IntegerJdbcType,JsonJdbcType,LongNVarcharJdbcType,LongVarbinaryJdbcType,LongVarcharJdbcType,NCharJdbcType,NClobJdbcType,NullJdbcType,NumericJdbcType,NVarcharJdbcType,ObjectJdbcType,ObjectNullAsBinaryTypeJdbcType,ObjectNullAsNullTypeJdbcType,ObjectNullResolvingJdbcType,OracleArrayJdbcType,OracleXmlJdbcType,PostgreSQLInetJdbcType,PostgreSQLIntervalSecondJdbcType,PostgreSQLJsonbJdbcType,PostgreSQLJsonJdbcType,PostgreSQLPGObjectJdbcType,RealJdbcType,SmallIntJdbcType,TimeJdbcType,TimestampJdbcType,TimestampWithTimeZoneJdbcType,TinyIntJdbcType,UUIDJdbcType,VarbinaryJdbcType,VarcharJdbcType,XmlAsStringJdbcType,XmlJdbcType
public interface JdbcType extends Serializable
Descriptor for the SQL/JDBC side of a value mapping.An instance of this type need not correspond directly to a SQL column type on a particular database. Rather, a
JdbcTypedefines how values are read from and written to JDBC. Therefore, implementations of this interface map more directly to the JDBC type codes defined byTypesandSqlTypes.A JDBC type may be selected when mapping an entity attribute using the
JdbcTypeannotation, or, indirectly, using theJdbcTypeCodeannotation.Custom implementations should be registered with the
JdbcTypeRegistryat startup. The built-in implementations are registered automatically.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <X> ValueBinder<X>getBinder(JavaType<X> javaType)Obtain a binder object capable of binding values of the given Java type to parameters of a JDBCPreparedStatement.default CastTypegetCastType()static CastTypegetCastType(int typeCode)default intgetDefaultSqlTypeCode()A JDBC type code that identifies the SQL column type to be used for schema generation.<X> ValueExtractor<X>getExtractor(JavaType<X> javaType)default StringgetFriendlyName()A "friendly" name for use in loggingdefault <T> JdbcLiteralFormatter<T>getJdbcLiteralFormatter(JavaType<T> javaType)default <T> BasicJavaType<T>getJdbcRecommendedJavaTypeMapping(Integer precision, Integer scale, TypeConfiguration typeConfiguration)intgetJdbcTypeCode()The JDBC type code used when interacting with JDBC APIs.default Class<?>getPreferredJavaTypeClass(WrapperOptions options)The Java type class that is preferred by the binder or null.default booleanisBinary()static booleanisBinary(int typeCode)default booleanisDecimal()static booleanisDecimal(int typeCode)default booleanisFloat()static booleanisFloat(int typeCode)default booleanisInteger()static booleanisInteger(int typeCode)default booleanisInterval()static booleanisInterval(int typeCode)default booleanisNumber()static booleanisNumber(int typeCode)default booleanisString()static booleanisString(int typeCode)default booleanisTemporal()static booleanisTemporal(int typeCode)
-
-
-
Method Detail
-
getFriendlyName
default String getFriendlyName()
A "friendly" name for use in logging
-
getJdbcTypeCode
int getJdbcTypeCode()
The JDBC type code used when interacting with JDBC APIs.For example, it's used when calling
PreparedStatement.setNull(int, int).- Returns:
- a JDBC type code
-
getDefaultSqlTypeCode
default int getDefaultSqlTypeCode()
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)to obtain the SQL column type.- Returns:
- a JDBC type code
-
getJdbcRecommendedJavaTypeMapping
default <T> BasicJavaType<T> getJdbcRecommendedJavaTypeMapping(Integer precision, Integer scale, TypeConfiguration typeConfiguration)
-
getJdbcLiteralFormatter
default <T> JdbcLiteralFormatter<T> getJdbcLiteralFormatter(JavaType<T> javaType)
-
getBinder
<X> ValueBinder<X> getBinder(JavaType<X> javaType)
Obtain a binder object capable of binding values of the given Java type to parameters of a JDBCPreparedStatement.- Parameters:
javaType- The descriptor describing the types of Java values to be bound- Returns:
- The appropriate binder.
-
getExtractor
<X> ValueExtractor<X> getExtractor(JavaType<X> javaType)
Obtain an extractor object capable of extracting values of the given Java type from a JDBCResultSet.- Parameters:
javaType- The descriptor describing the types of Java values to be extracted- Returns:
- The appropriate extractor
-
getPreferredJavaTypeClass
default Class<?> getPreferredJavaTypeClass(WrapperOptions options)
The Java type class that is preferred by the binder or null.
-
isInteger
default boolean isInteger()
-
isInteger
static boolean isInteger(int typeCode)
-
isFloat
default boolean isFloat()
-
isFloat
static boolean isFloat(int typeCode)
-
isDecimal
default boolean isDecimal()
-
isDecimal
static boolean isDecimal(int typeCode)
-
isNumber
default boolean isNumber()
-
isNumber
static boolean isNumber(int typeCode)
-
isBinary
default boolean isBinary()
-
isBinary
static boolean isBinary(int typeCode)
-
isString
default boolean isString()
-
isString
static boolean isString(int typeCode)
-
isTemporal
default boolean isTemporal()
-
isTemporal
static boolean isTemporal(int typeCode)
-
isInterval
default boolean isInterval()
-
isInterval
static boolean isInterval(int typeCode)
-
getCastType
default CastType getCastType()
-
getCastType
static CastType getCastType(int typeCode)
-
-