Interface JdbcType
-
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
AdjustableJdbcType
- All Known Implementing Classes:
AbstractHANADialect.HANABlobType
,AbstractPostGISJdbcType
,AbstractSqlServerGISType
,ArrayJdbcType
,BigIntJdbcType
,BinaryJdbcType
,BlobJdbcType
,BooleanJdbcType
,CharJdbcType
,ClobJdbcType
,DateJdbcType
,DB2GeometryType
,DecimalJdbcType
,DoubleJdbcType
,FloatJdbcType
,H2DurationIntervalSecondJdbcType
,H2GISGeometryType
,HANAGeometryType
,HANAPointType
,InstantAsTimestampJdbcType
,InstantAsTimestampWithTimeZoneJdbcType
,InstantJdbcType
,IntegerJdbcType
,JsonJdbcType
,LongNVarcharJdbcType
,LongVarbinaryJdbcType
,LongVarcharJdbcType
,MySQLGeometryJdbcType
,NCharJdbcType
,NClobJdbcType
,NullJdbcType
,NumericJdbcType
,NVarcharJdbcType
,ObjectJdbcType
,ObjectNullAsBinaryTypeJdbcType
,ObjectNullAsNullTypeJdbcType
,ObjectNullResolvingJdbcType
,OracleArrayJdbcType
,OracleXmlJdbcType
,PGGeographyJdbcType
,PGGeometryJdbcType
,PostgreSQLInetJdbcType
,PostgreSQLIntervalSecondJdbcType
,PostgreSQLJsonbJdbcType
,PostgreSQLJsonJdbcType
,PostgreSQLPGObjectJdbcType
,RealJdbcType
,SDOGeometryType
,SmallIntJdbcType
,SqlServerGeographyType
,SqlServerGeometryType
,TimeJdbcType
,TimestampJdbcType
,TimestampWithTimeZoneJdbcType
,TinyIntJdbcType
,UserTypeSqlTypeAdapter
,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
JdbcType
defines how values are read from and written to JDBC. Therefore, implementations of this interface map more directly to the JDBC type codes defined byTypes
andSqlTypes
.A JDBC type may be selected when mapping an entity attribute using the
JdbcType
annotation, or, indirectly, using theJdbcTypeCode
annotation.Custom implementations should be registered with the
JdbcTypeRegistry
at 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 CastType
getCastType()
static CastType
getCastType(int typeCode)
default int
getDefaultSqlTypeCode()
A JDBC type code that identifies the SQL column type.<X> ValueExtractor<X>
getExtractor(JavaType<X> javaType)
default String
getFriendlyName()
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)
int
getJdbcTypeCode()
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 boolean
isBinary()
static boolean
isBinary(int typeCode)
default boolean
isDecimal()
static boolean
isDecimal(int typeCode)
default boolean
isFloat()
static boolean
isFloat(int typeCode)
default boolean
isInteger()
static boolean
isInteger(int typeCode)
default boolean
isInterval()
static boolean
isInterval(int typeCode)
default boolean
isNumber()
static boolean
isNumber(int typeCode)
default boolean
isString()
static boolean
isString(int typeCode)
default boolean
isTemporal()
static boolean
isTemporal(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.This value might be different from
#getDdlTypeCode()
if the actual type e.g. JSON is emulated through a type like CLOB.- 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)
-
-