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 SQLDialect, and in particular of the methodcolumnType(), to interpret these type codes as column type names.
A type code is often used as a key to obtain aJdbcType, by implementors ofJavaType.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-specificDdlType for the purposes of generating DDL.
- See Also:
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intA type code representing the generic SQL typeARRAY.static final intA type code representing the generic SQL typeBIGINT.static final intA type code representing the generic SQL typeBINARY.static final intA type code representing generic SQL typeBIT.static final intA type code representing the generic SQL typeBLOB.static final intA type code representing the generic SQL typeBOOLEAN.static final intA type code representing the generic SQL typeCHAR.static final intA type code representing the generic SQL typeCLOB.static final intA type code representing the generic SQL typeDATALINK.static final intA type code representing the generic SQL typeDATE.static final intA type code representing the generic SQL typeDECIMAL.static final intA type code representing the generic SQL typeDISTINCT.static final intA type code representing the generic SQL typeDOUBLE.static final intA type code representing a "virtual mapping" ofDuration.static final intstatic final intA type code representing the generic SQL typeFLOAT.static final intA type code representing the generic SQL typeGEOGRAPHY.static final intA type code representing the generic SQL typeGEOMETRY.static final intA type code representing the generic SQL typeINETfor IPv4 or IPv6 addresses.static final intA type code representing a "virtual mapping" ofInstant as a JDBC type usingResultSet.getObject(int) andPreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.static final intA type code representing the generic SQL typeINTEGER.static final intA type code representing the generic SQL typeINTERVAL SECONDfor a temporal duration given terms of seconds and fractional seconds.static final intA type code representing the generic SQL typeJAVA_OBJECT.static final intA type code representing the generic SQL typeJSON.static final intA type code for an array of json objects.static final intA type code representing a "virtual mapping" ofLocalDate as a JDBC type usingResultSet.getObject(int) andPreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.static final intA type code representing a "virtual mapping" ofLocalDateTime as a JDBC type usingResultSet.getObject(int) andPreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.static final intA type code representing a "virtual mapping" ofLocalTime as a JDBC type usingResultSet.getObject(int) andPreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.static final intstatic final intstatic final intstatic final intA type code representing the generic SQL typeLONGNVARCHAR.static final intA type code representing the generic SQL typeLONGVARBINARY.static final intA type code representing the generic SQL typeLONGVARCHAR.static final intThe constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL typeMATERIALIZED_BLOB.static final intThe constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL typeMATERIALIZED_CLOB.static final intThe constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL typeMATERIALIZED_NCLOB.static final intA type code representing a SQLENUMtype for databases likePostgreSQLorOraclewhereENUMtypes must have names.static final intA type code representing a SQLENUMtype for databases likePostgreSQLwhereENUMtypes must have names.static final intA type code representing the generic SQL typeNCHAR.static final intA type code representing the generic SQL typeNCLOB.static final intA type code representing the generic SQL valueNULL.static final intA type code representing the generic SQL typeNUMERIC.static final intA type code representing the generic SQL typeNVARCHAR.static final intA type code representing a "virtual mapping" ofOffsetDateTime as a JDBC type usingResultSet.getObject(int) andPreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.static final intA type code representing a "virtual mapping" ofOffsetTime as a JDBC type usingResultSet.getObject(int) andPreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.static final intstatic final intA 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 intA type code representing the generic SQL typePOINT.static final intA type code representing the generic SQL typeREAL.static final intA type code representing the generic SQL typeREF.static final intA type code representing the generic SQL typeREF CURSOR.static final intA type code representing the generic SQL typeROWID.static final intA type code representing the generic SQL typeSMALLINT.static final intA type code representing the generic SQL typeXML.static final intA type code representing the generic SQL typeSTRUCT.static final intA type code for an array of struct objects.static final intA type code representing an Oracle-style nested table for a struct.static final intA type code representing an Oracle-style nested table.static final intA type code representing the generic SQL typeTIME.static final intA type code representing the generic SQL typeTIME, where the value is given in UTC, instead of in the system orJDBC timezone.static final intA type code representing identifies the generic SQL typeTIME WITH TIMEZONE.static final intA type code representing the generic SQL typeTIMESTAMP.static final intA type code representing the generic SQL typeTIMESTAMP, where the value is given in UTC, instead of in the system orJDBC timezone.static final intA type code representing the generic SQL typeTIMESTAMP WITH TIMEZONE.static final intA type code representing the generic SQL typeTINYINT.static final intA type code representing the generic SQL typeUUID.static final intA type code representing the generic SQL typeVARBINARY.static final intA type code representing the generic SQL typeVARCHAR.static final intA type code representing anembedding vectortype for databases likePostgreSQL,Oracle 23aiandMariaDB.static final intA type code representing a single-precision floating-point vector type for Oracle 23ai database.static final intA type code representing a double-precision floating-point type for Oracle 23ai database.static final intA type code representing a single-byte integer vector type for Oracle 23ai database.static final intA type code for an array of xml objects.static final intA type code representing a "virtual mapping" ofZonedDateTime as a JDBC type usingResultSet.getObject(int) andPreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.Method Summary
Modifier and TypeMethodDescriptionstatic booleanhasDatePart(int typeCode) Does the given typecode represent a SQL date or timestamp type?static booleanhasTimePart(int typeCode) Does the given typecode represent a SQL time or timestamp type?static booleanisBinaryType(int typeCode) Does the given JDBC type code represent some sort of variable-length binary string or BLOB type?static booleanisCharacterOrClobType(int typeCode) Does the given JDBC type code represent some sort of character string type?static booleanisCharacterType(int typeCode) Does the given JDBC type code represent some sort of character string type?static booleanisDurationType(int typeCode) Does the given typecode represent adurationtype?static booleanisEnumType(int typeCode) static booleanisFloatOrRealOrDouble(int typeCode) Does the given typecode represent a SQL floating point type?static booleanisImplicitJsonType(int typeCode) Does the typecode represent a JSON type or a type that can be implicitly cast to JSON.static booleanisImplicitXmlType(int typeCode) Does the typecode represent an XML type or a type that can be implicitly cast to XML.static booleanisIntegral(int typeCode) Does the given typecode represent a SQL integer type?static booleanisIntervalType(int typeCode) Does the given typecode represent a SQLintervaltype?static booleanisJsonType(int typeCode) Does the typecode represent a JSON type.static booleanisNumericOrDecimal(int typeCode) Does the given typecode represent one of the two SQL decimal types?static booleanisNumericType(int typeCode) Does the given JDBC type code represent some sort of numeric type?static booleanisSmallOrTinyInt(int typeCode) static booleanisSpatialType(int typeCode) Does the typecode represent a spatial (Geometry or Geography) type.static booleanisStringType(int typeCode) Is this a type with a length, that is, is it some kind of character string or binary string?static booleanisTemporalType(int typeCode) Does the given typecode represent a SQL date, time, or timestamp type?static booleanisVarbinaryType(int typeCode) Does the given JDBC type code represent some sort of variable-length binary string type?static booleanisVarcharType(int typeCode) Does the given JDBC type code represent some sort of variable-length character string type?static booleanisXmlType(int typeCode) Does the typecode represent a XML 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.FLOAT
public static final int FLOATA type code representing the generic SQL typeFLOAT.REAL
public static final int REALA type code representing the generic SQL typeREAL.DOUBLE
public static final int DOUBLEA type code representing the generic SQL typeDOUBLE.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.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 HibernateDialectto identify aVARCHAR-like type large enough to hold any Java string.In principle, the type must accommodate strings of length2147483647, 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.TIME
public static final int TIMEA type code representing the generic SQL typeTIME.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.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 SQLdialect to identify aVARBINARY-like type large enough to hold any Java byte array.In principle, the type must accommodate arrays of length2147483647, 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.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.CLOB
public static final int CLOBA type code representing the generic SQL typeCLOB.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.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 HibernateDialectto identify anNVARCHAR-like type large enough to hold any Java string.In principle, the type must accommodate strings of length2147483647, 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.SQLXML
public static final int SQLXMLA type code representing the generic SQL typeXML.REF_CURSOR
public static final int REF_CURSORA type code representing the generic SQL typeREF CURSOR.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 typeINETfor IPv4 or IPv6 addresses.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 orJDBC 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 useVARBINARYsemantics, but theDdlTypeshould 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 useVARCHARsemantics, but theDdlTypeshould 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 useNVARCHARsemantics, but theDdlTypeshould 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 orJDBC timezone.INSTANT
public static final int INSTANTA type code representing a "virtual mapping" ofInstant as a JDBC type usingResultSet.getObject(int) andPreparedStatement.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" ofLocalDateTime as a JDBC type usingResultSet.getObject(int) andPreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.LOCAL_DATE
public static final int LOCAL_DATEA type code representing a "virtual mapping" ofLocalDate as a JDBC type usingResultSet.getObject(int) andPreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.LOCAL_TIME
public static final int LOCAL_TIMEA type code representing a "virtual mapping" ofLocalTime as a JDBC type usingResultSet.getObject(int) andPreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.OFFSET_DATE_TIME
public static final int OFFSET_DATE_TIMEA type code representing a "virtual mapping" ofOffsetDateTime as a JDBC type usingResultSet.getObject(int) andPreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.OFFSET_TIME
public static final int OFFSET_TIMEA type code representing a "virtual mapping" ofOffsetTime as a JDBC type usingResultSet.getObject(int) andPreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.ZONED_DATE_TIME
public static final int ZONED_DATE_TIMEA type code representing a "virtual mapping" ofZonedDateTime as a JDBC type usingResultSet.getObject(int) andPreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.DURATION
public static final int DURATIONA type code representing a "virtual mapping" ofDuration.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 SECONDfor 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 ENUM- Since:
- 6.3
- See Also:
NAMED_ENUM
public static final int NAMED_ENUMA type code representing a SQLENUMtype for databases likePostgreSQLorOraclewhereENUMtypes must have names.A named enum type is declared in DDL using
create type ... as enumorcreate type ... as domain.- Since:
- 6.3
- See Also:
ORDINAL_ENUM
public static final int ORDINAL_ENUMA type code representing a SQLENUMtype for databases likeMySQLwhereENUMtypes 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 SQLENUMtype for databases likePostgreSQLwhereENUMtypes must have names. Enum values are ordered by ordinal.- Since:
- 6.5
- See Also:
VECTOR
public static final int VECTORA type code representing anembedding vectortype for databases likePostgreSQL,Oracle 23aiandMariaDB. 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 SQLintervaltype?isDurationType
public static boolean isDurationType(int typeCode) Does the given typecode represent adurationtype?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) isJsonType
public static boolean isJsonType(int typeCode) Does the typecode represent a JSON type.- Parameters:
typeCode- - a JDBC type code- Since:
- 7.0
isImplicitJsonType
public static boolean isImplicitJsonType(int typeCode) Does the typecode represent a JSON type or a type that can be implicitly cast to JSON.- Parameters:
typeCode- - a JDBC type code- Since:
- 7.0
isXmlType
public static boolean isXmlType(int typeCode) Does the typecode represent a XML type.- Parameters:
typeCode- - a JDBC type code- Since:
- 7.0
isImplicitXmlType
public static boolean isImplicitXmlType(int typeCode) Does the typecode represent an XML type or a type that can be implicitly cast to XML.- Parameters:
typeCode- - a JDBC type code- Since:
- 7.0