Class SqlTypes
Types
, defining
additional type codes for types that Hibernate supports but which are not
recognized by the JDBC specification.
Each of these type codes represents an abstraction over a family of
similar types in different databases. It's the job of the SQL
Dialect
, and in particular of the method
columnType()
, to interpret these type codes as column type names.
A type code is often used as a key to obtain a
JdbcType
, by implementors of
JavaType.getRecommendedJdbcType(org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators)
,
or when the @JdbcTypeCode
annotation is used, for example.
A type code may also be used as a key to obtain a dialect-specific
DdlType
for the purposes of
generating DDL.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
A type code representing the generic SQL typeARRAY
.static final int
A type code representing the generic SQL typeBIGINT
.static final int
A type code representing the generic SQL typeBINARY
.static final int
A type code representing generic SQL typeBIT
.static final int
A type code representing the generic SQL typeBLOB
.static final int
A type code representing the generic SQL typeBOOLEAN
.static final int
A type code representing the generic SQL typeCHAR
.static final int
A type code representing the generic SQL typeCLOB
.static final int
A type code representing the generic SQL typeDATALINK
.static final int
A type code representing the generic SQL typeDATE
.static final int
A type code representing the generic SQL typeDECIMAL
.static final int
A type code representing the generic SQL typeDISTINCT
.static final int
A type code representing the generic SQL typeDOUBLE
.static final int
A type code representing a "virtual mapping" of Duration.static final int
A type code representing a SQLENUM
type for databases likeMySQL
whereENUM
types do not have names.static final int
A type code representing the generic SQL typeFLOAT
.static final int
A type code representing the generic SQL typeGEOGRAPHY
.static final int
A type code representing the generic SQL typeGEOMETRY
.static final int
A type code representing the generic SQL typeINET
for IPv4 or IPv6 addresses.static final int
A type code representing a "virtual mapping" of Instant as a JDBC type using ResultSet.getObject(int) and PreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.static final int
A type code representing the generic SQL typeINTEGER
.static final int
A type code representing the generic SQL typeINTERVAL SECOND
for a temporal duration given terms of seconds and fractional seconds.static final int
A type code representing the generic SQL typeJAVA_OBJECT
.static final int
A type code representing the generic SQL typeJSON
.static final int
A type code for an array of json objects.static final int
A type code representing a "virtual mapping" of LocalDate as a JDBC type using ResultSet.getObject(int) and PreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.static final int
A type code representing a "virtual mapping" of LocalDateTime as a JDBC type using ResultSet.getObject(int) and PreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.static final int
A type code representing a "virtual mapping" of LocalTime as a JDBC type using ResultSet.getObject(int) and PreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.static final int
static final int
static final int
static final int
A type code representing the generic SQL typeLONGNVARCHAR
.static final int
A type code representing the generic SQL typeLONGVARBINARY
.static final int
A type code representing the generic SQL typeLONGVARCHAR
.static final int
The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL typeMATERIALIZED_BLOB
.static final int
The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL typeMATERIALIZED_CLOB
.static final int
The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL typeMATERIALIZED_NCLOB
.static final int
A type code representing a SQLENUM
type for databases likePostgreSQL
whereENUM
types must have names.static final int
A type code representing a SQLENUM
type for databases likePostgreSQL
whereENUM
types must have names.static final int
A type code representing the generic SQL typeNCHAR
.static final int
A type code representing the generic SQL typeNCLOB
.static final int
A type code representing the generic SQL valueNULL
.static final int
A type code representing the generic SQL typeNUMERIC
.static final int
A type code representing the generic SQL typeNVARCHAR
.static final int
A type code representing a "virtual mapping" of OffsetDateTime as a JDBC type using ResultSet.getObject(int) and PreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.static final int
A type code representing a "virtual mapping" of OffsetTime as a JDBC type using ResultSet.getObject(int) and PreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.static final int
A type code representing a SQLENUM
type for databases likeMySQL
whereENUM
types do not have names.static final int
A type code indicating that the SQL type is SQL dialect-specific and is mapped to a Java object that can be accessed via the methodsResultSet.getObject(int)
andPreparedStatement.setObject(int, java.lang.Object, int)
.static final int
A type code representing the generic SQL typePOINT
.static final int
A type code representing the generic SQL typeREAL
.static final int
A type code representing the generic SQL typeREF
.static final int
A type code representing the generic SQL typeREF CURSOR
.static final int
A type code representing the generic SQL typeROWID
.static final int
A type code representing the generic SQL typeSMALLINT
.static final int
A type code representing the generic SQL typeXML
.static final int
A type code representing the generic SQL typeSTRUCT
.static final int
A type code for an array of struct objects.static final int
A type code representing an Oracle-style nested table for a struct.static final int
A type code representing an Oracle-style nested table.static final int
A type code representing the generic SQL typeTIME
.static final int
A type code representing the generic SQL typeTIME
, where the value is given in UTC, instead of in the system or JDBC timezone.static final int
A type code representing identifies the generic SQL typeTIME WITH TIMEZONE
.static final int
A type code representing the generic SQL typeTIMESTAMP
.static final int
A type code representing the generic SQL typeTIMESTAMP
, where the value is given in UTC, instead of in the system or JDBC timezone.static final int
A type code representing the generic SQL typeTIMESTAMP WITH TIMEZONE
.static final int
A type code representing the generic SQL typeTINYINT
.static final int
A type code representing the generic SQL typeUUID
.static final int
A type code representing the generic SQL typeVARBINARY
.static final int
A type code representing the generic SQL typeVARCHAR
.static final int
static final int
A type code representing a single-precision floating-point vector type for oracle 23ai database.static final int
A type code representing a double-precision floating-point type for oracle 23ai database.static final int
A type code representing a single-byte integer vector type for oracle 23ai database.static final int
A type code for an array of xml objects.static final int
A type code representing a "virtual mapping" of ZonedDateTime as a JDBC type using ResultSet.getObject(int) and PreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
hasDatePart
(int typeCode) Does the given typecode represent a SQL date or timestamp type?static boolean
hasTimePart
(int typeCode) Does the given typecode represent a SQL time or timestamp type?static boolean
isBinaryType
(int typeCode) Does the given JDBC type code represent some sort of variable-length binary string or BLOB type?static boolean
isCharacterOrClobType
(int typeCode) Does the given JDBC type code represent some sort of character string type?static boolean
isCharacterType
(int typeCode) Does the given JDBC type code represent some sort of character string type?static boolean
isDurationType
(int typeCode) Does the given typecode represent aduration
type?static boolean
isEnumType
(int typeCode) static boolean
isFloatOrRealOrDouble
(int typeCode) Does the given typecode represent a SQL floating point type?static boolean
isIntegral
(int typeCode) Does the given typecode represent a SQL integer type?static boolean
isIntervalType
(int typeCode) Does the given typecode represent a SQLinterval
type?static boolean
isNumericOrDecimal
(int typeCode) Does the given typecode represent one of the two SQL decimal types?static boolean
isNumericType
(int typeCode) Does the given JDBC type code represent some sort of numeric type?static boolean
isSmallOrTinyInt
(int typeCode) static boolean
isSpatialType
(int typeCode) Does the typecode represent a spatial (Geometry or Geography) type.static boolean
isStringType
(int typeCode) Is this a type with a length, that is, is it some kind of character string or binary string?static boolean
isTemporalType
(int typeCode) Does the given typecode represent a SQL date, time, or timestamp type?static boolean
isVarbinaryType
(int typeCode) Does the given JDBC type code represent some sort of variable-length binary string type?static boolean
isVarcharType
(int typeCode) Does the given JDBC type code represent some sort of variable-length character string type?
-
Field Details
-
BIT
public static final int BITA type code representing generic SQL typeBIT
.- See Also:
-
TINYINT
public static final int TINYINTA type code representing the generic SQL typeTINYINT
. -
SMALLINT
public static final int SMALLINTA type code representing the generic SQL typeSMALLINT
. -
INTEGER
public static final int INTEGERA type code representing the generic SQL typeINTEGER
. -
BIGINT
public static final int BIGINTA type code representing the generic SQL typeBIGINT
.- See Also:
-
FLOAT
public static final int FLOATA type code representing the generic SQL typeFLOAT
.- See Also:
-
REAL
public static final int REALA type code representing the generic SQL typeREAL
.- See Also:
-
DOUBLE
public static final int DOUBLEA type code representing the generic SQL typeDOUBLE
.- See Also:
-
NUMERIC
public static final int NUMERICA type code representing the generic SQL typeNUMERIC
. -
DECIMAL
public static final int DECIMALA type code representing the generic SQL typeDECIMAL
. -
CHAR
public static final int CHARA type code representing the generic SQL typeCHAR
.- See Also:
-
VARCHAR
public static final int VARCHARA type code representing the generic SQL typeVARCHAR
. -
LONGVARCHAR
public static final int LONGVARCHARA type code representing the generic SQL typeLONGVARCHAR
.Interpreted by Hibernate as a
VARCHAR
-like type large enough to hold a string of maximum lengthLength.LONG
.Apart from the larger default column length, this type code is treated as a synonym for
VARCHAR
. -
LONG32VARCHAR
public static final int LONG32VARCHARA type code used internally by the HibernateDialect
to identify aVARCHAR
-like type large enough to hold any Java string.In principle, the type must accommodate strings of length 2147483647, though this is not an absolutely hard requirement, since such large strings do not occur in practice.
- See Also:
-
DATE
public static final int DATEA type code representing the generic SQL typeDATE
.- See Also:
-
TIME
public static final int TIMEA type code representing the generic SQL typeTIME
.- See Also:
-
TIMESTAMP
public static final int TIMESTAMPA type code representing the generic SQL typeTIMESTAMP
. -
BINARY
public static final int BINARYA type code representing the generic SQL typeBINARY
.- See Also:
-
VARBINARY
public static final int VARBINARYA type code representing the generic SQL typeVARBINARY
. -
LONGVARBINARY
public static final int LONGVARBINARYA type code representing the generic SQL typeLONGVARBINARY
.Interpreted by Hibernate as a
VARBINARY
-like type large enough to hold a byte array of maximum lengthLength.LONG
.Apart from the larger default column length, this type code is treated as a synonym for
VARBINARY
. -
LONG32VARBINARY
public static final int LONG32VARBINARYA type code used by the Hibernate SQL dialect to identify aVARBINARY
-like type large enough to hold any Java byte array.In principle, the type must accommodate arrays of length 2147483647, though this is not an absolutely hard requirement, since such large arrays do not occur in practice.
- See Also:
-
NULL
public static final int NULLA type code representing the generic SQL valueNULL
.- See Also:
-
OTHER
public static final int OTHERA type code indicating that the SQL type is SQL dialect-specific and is mapped to a Java object that can be accessed via the methodsResultSet.getObject(int)
andPreparedStatement.setObject(int, java.lang.Object, int)
.- See Also:
-
JAVA_OBJECT
public static final int JAVA_OBJECTA type code representing the generic SQL typeJAVA_OBJECT
. -
DISTINCT
public static final int DISTINCTA type code representing the generic SQL typeDISTINCT
.- See Also:
-
STRUCT
public static final int STRUCTA type code representing the generic SQL typeSTRUCT
.- See Also:
-
ARRAY
public static final int ARRAYA type code representing the generic SQL typeARRAY
.- See Also:
-
TABLE
public static final int TABLEA type code representing an Oracle-style nested table. -
BLOB
public static final int BLOBA type code representing the generic SQL typeBLOB
.- See Also:
-
CLOB
public static final int CLOBA type code representing the generic SQL typeCLOB
.- See Also:
-
REF
public static final int REFA type code representing the generic SQL typeREF
.- See Also:
-
DATALINK
public static final int DATALINKA type code representing the generic SQL typeDATALINK
.- See Also:
-
BOOLEAN
public static final int BOOLEANA type code representing the generic SQL typeBOOLEAN
. -
ROWID
public static final int ROWIDA type code representing the generic SQL typeROWID
.- See Also:
-
NCHAR
public static final int NCHARA type code representing the generic SQL typeNCHAR
.- See Also:
-
NVARCHAR
public static final int NVARCHARA type code representing the generic SQL typeNVARCHAR
. -
LONGNVARCHAR
public static final int LONGNVARCHARA type code representing the generic SQL typeLONGNVARCHAR
.Interpreted by Hibernate as an
NVARCHAR
-like type large enough to hold a string of maximum lengthLength.LONG
.Apart from the larger default column length, this type code is treated as a synonym for
NVARCHAR
. -
LONG32NVARCHAR
public static final int LONG32NVARCHARA type code used internally by the HibernateDialect
to identify anNVARCHAR
-like type large enough to hold any Java string.In principle, the type must accommodate strings of length 2147483647, though this is not an absolutely hard requirement, since such large strings do not occur in practice.
- See Also:
-
NCLOB
public static final int NCLOBA type code representing the generic SQL typeNCLOB
.- See Also:
-
SQLXML
public static final int SQLXMLA type code representing the generic SQL typeXML
.- See Also:
-
REF_CURSOR
public static final int REF_CURSORA type code representing the generic SQL typeREF CURSOR
.- See Also:
-
TIME_WITH_TIMEZONE
public static final int TIME_WITH_TIMEZONEA type code representing identifies the generic SQL typeTIME WITH TIMEZONE
. -
TIMESTAMP_WITH_TIMEZONE
public static final int TIMESTAMP_WITH_TIMEZONEA type code representing the generic SQL typeTIMESTAMP WITH TIMEZONE
. -
UUID
public static final int UUIDA type code representing the generic SQL typeUUID
. -
JSON
public static final int JSONA type code representing the generic SQL typeJSON
.- See Also:
-
INET
public static final int INETA type code representing the generic SQL typeINET
for IPv4 or IPv6 addresses.- See Also:
-
TIMESTAMP_UTC
public static final int TIMESTAMP_UTCA type code representing the generic SQL typeTIMESTAMP
, where the value is given in UTC, instead of in the system or JDBC timezone. -
MATERIALIZED_BLOB
The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL typeMATERIALIZED_BLOB
. This type is used when JDBC access should useVARBINARY
semantics, but theDdlType
should be based onBLOB
.- See Also:
-
MATERIALIZED_CLOB
The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL typeMATERIALIZED_CLOB
. This type is used when JDBC access should useVARCHAR
semantics, but theDdlType
should be based onCLOB
.- See Also:
-
MATERIALIZED_NCLOB
The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL typeMATERIALIZED_NCLOB
. This type is used when JDBC access should useNVARCHAR
semantics, but theDdlType
should be based onNCLOB
.- See Also:
-
TIME_UTC
public static final int TIME_UTCA type code representing the generic SQL typeTIME
, where the value is given in UTC, instead of in the system or JDBC timezone. -
INSTANT
public static final int INSTANTA type code representing a "virtual mapping" of Instant as a JDBC type using ResultSet.getObject(int) and PreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.- See Also:
-
LOCAL_DATE_TIME
public static final int LOCAL_DATE_TIMEA type code representing a "virtual mapping" of LocalDateTime as a JDBC type using ResultSet.getObject(int) and PreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.- See Also:
-
LOCAL_DATE
public static final int LOCAL_DATEA type code representing a "virtual mapping" of LocalDate as a JDBC type using ResultSet.getObject(int) and PreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.- See Also:
-
LOCAL_TIME
public static final int LOCAL_TIMEA type code representing a "virtual mapping" of LocalTime as a JDBC type using ResultSet.getObject(int) and PreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.- See Also:
-
OFFSET_DATE_TIME
public static final int OFFSET_DATE_TIMEA type code representing a "virtual mapping" of OffsetDateTime as a JDBC type using ResultSet.getObject(int) and PreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.- See Also:
-
OFFSET_TIME
public static final int OFFSET_TIMEA type code representing a "virtual mapping" of OffsetTime as a JDBC type using ResultSet.getObject(int) and PreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.- See Also:
-
ZONED_DATE_TIME
public static final int ZONED_DATE_TIMEA type code representing a "virtual mapping" of ZonedDateTime as a JDBC type using ResultSet.getObject(int) and PreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.- See Also:
-
DURATION
public static final int DURATIONA type code representing a "virtual mapping" of Duration. -
STRUCT_ARRAY
public static final int STRUCT_ARRAYA type code for an array of struct objects.- See Also:
-
STRUCT_TABLE
public static final int STRUCT_TABLEA type code representing an Oracle-style nested table for a struct. -
JSON_ARRAY
public static final int JSON_ARRAYA type code for an array of json objects.- See Also:
-
XML_ARRAY
public static final int XML_ARRAYA type code for an array of xml objects.- See Also:
-
INTERVAL_SECOND
public static final int INTERVAL_SECONDA type code representing the generic SQL typeINTERVAL SECOND
for a temporal duration given terms of seconds and fractional seconds. -
GEOMETRY
public static final int GEOMETRYA type code representing the generic SQL typeGEOMETRY
.- See Also:
-
POINT
public static final int POINTA type code representing the generic SQL typePOINT
.- See Also:
-
GEOGRAPHY
public static final int GEOGRAPHYA type code representing the generic SQL typeGEOGRAPHY
.- Since:
- 6.0.1
- See Also:
-
ENUM
public static final int ENUMA type code representing a SQLENUM
type for databases likeMySQL
whereENUM
types do not have names.- Since:
- 6.3
- See Also:
-
NAMED_ENUM
public static final int NAMED_ENUMA type code representing a SQLENUM
type for databases likePostgreSQL
whereENUM
types must have names.- Since:
- 6.3
- See Also:
-
ORDINAL_ENUM
public static final int ORDINAL_ENUMA type code representing a SQLENUM
type for databases likeMySQL
whereENUM
types do not have names. Enum values are ordered by ordinal.- Since:
- 6.5
- See Also:
-
NAMED_ORDINAL_ENUM
public static final int NAMED_ORDINAL_ENUMA type code representing a SQLENUM
type for databases likePostgreSQL
whereENUM
types must have names. Enum values are ordered by ordinal.- Since:
- 6.5
- See Also:
-
VECTOR
public static final int VECTORA type code representing anembedding vector
type for databases likePostgreSQL
andOracle 23ai
. An embedding vector essentially is afloat[]
with a fixed size.- Since:
- 6.4
- See Also:
-
VECTOR_INT8
public static final int VECTOR_INT8A type code representing a single-byte integer vector type for oracle 23ai database.- See Also:
-
VECTOR_FLOAT32
public static final int VECTOR_FLOAT32A type code representing a single-precision floating-point vector type for oracle 23ai database.- See Also:
-
VECTOR_FLOAT64
public static final int VECTOR_FLOAT64A type code representing a double-precision floating-point type for oracle 23ai database.- See Also:
-
-
Method Details
-
isNumericType
public static boolean isNumericType(int typeCode) Does the given JDBC type code represent some sort of numeric type?- Parameters:
typeCode
- a JDBC type code fromTypes
-
isStringType
public static boolean isStringType(int typeCode) Is this a type with a length, that is, is it some kind of character string or binary string?- Parameters:
typeCode
- a JDBC type code fromTypes
-
isCharacterOrClobType
public static boolean isCharacterOrClobType(int typeCode) Does the given JDBC type code represent some sort of character string type?- Parameters:
typeCode
- a JDBC type code fromTypes
-
isCharacterType
public static boolean isCharacterType(int typeCode) Does the given JDBC type code represent some sort of character string type?- Parameters:
typeCode
- a JDBC type code fromTypes
-
isVarcharType
public static boolean isVarcharType(int typeCode) Does the given JDBC type code represent some sort of variable-length character string type?- Parameters:
typeCode
- a JDBC type code fromTypes
-
isVarbinaryType
public static boolean isVarbinaryType(int typeCode) Does the given JDBC type code represent some sort of variable-length binary string type?- Parameters:
typeCode
- a JDBC type code fromTypes
-
isBinaryType
public static boolean isBinaryType(int typeCode) Does the given JDBC type code represent some sort of variable-length binary string or BLOB type?- Parameters:
typeCode
- a JDBC type code fromTypes
-
isNumericOrDecimal
public static boolean isNumericOrDecimal(int typeCode) Does the given typecode represent one of the two SQL decimal types?- Parameters:
typeCode
- a JDBC type code fromTypes
-
isFloatOrRealOrDouble
public static boolean isFloatOrRealOrDouble(int typeCode) Does the given typecode represent a SQL floating point type?- Parameters:
typeCode
- a JDBC type code fromTypes
-
isIntegral
public static boolean isIntegral(int typeCode) Does the given typecode represent a SQL integer type?- Parameters:
typeCode
- a JDBC type code fromTypes
-
isSmallOrTinyInt
-
isTemporalType
public static boolean isTemporalType(int typeCode) Does the given typecode represent a SQL date, time, or timestamp type?- Parameters:
typeCode
- a JDBC type code fromTypes
-
isIntervalType
public static boolean isIntervalType(int typeCode) Does the given typecode represent a SQLinterval
type? -
isDurationType
public static boolean isDurationType(int typeCode) Does the given typecode represent aduration
type? -
hasDatePart
public static boolean hasDatePart(int typeCode) Does the given typecode represent a SQL date or timestamp type?- Parameters:
typeCode
- a JDBC type code fromTypes
-
hasTimePart
public static boolean hasTimePart(int typeCode) Does the given typecode represent a SQL time or timestamp type?- Parameters:
typeCode
- a JDBC type code fromTypes
-
isSpatialType
public static boolean isSpatialType(int typeCode) Does the typecode represent a spatial (Geometry or Geography) type.- Parameters:
typeCode
- - a JDBC type code
-
isEnumType
public static boolean isEnumType(int typeCode)
-