Package org.hibernate.type

Class SqlTypes

java.lang.Object
org.hibernate.type.SqlTypes

public classSqlTypesextendsObject
Defines a list of constant type codes used to identify generic SQL types. This is an extension of the standard JDBC-definedTypes, 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

    Fields
    Modifier and Type
    Field
    Description
    static 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" ofDuration.
    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" ofInstant as a JDBC type usingResultSet.getObject(int) andPreparedStatement.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" ofLocalDate as a JDBC type usingResultSet.getObject(int) andPreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.
    static final int
    A 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 int
    A 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 int
    A type code used internally by the HibernateDialect to identify anNVARCHAR-like type large enough to hold any Java string.
    static final int
    A type code used by the Hibernate SQLdialect to identify aVARBINARY-like type large enough to hold any Java byte array.
    static final int
    A type code used internally by the HibernateDialect to identify aVARCHAR-like type large enough to hold any Java string.
    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 orOracle 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" ofOffsetDateTime as a JDBC type usingResultSet.getObject(int) andPreparedStatement.setObject(int, java.lang.Object, int) which JDBC requires compliant drivers to support.
    static final int
    A 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 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 orJDBC 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 orJDBC 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
    A type code representing anembedding vector type for databases likePostgreSQL,Oracle 23ai andMariaDB.
    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" 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 Type
    Method
    Description
    static 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
    isImplicitJsonType(int typeCode)
    Does the typecode represent a JSON type or a type that can be implicitly cast to JSON.
    static boolean
    isImplicitXmlType(int typeCode)
    Does the typecode represent an XML type or a type that can be implicitly cast to XML.
    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
    isJsonType(int typeCode)
    Does the typecode represent a JSON 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?
    static boolean
    isXmlType(int typeCode)
    Does the typecode represent a XML type.