Package org.hibernate.type

Class 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:
    JdbcTypeRegistry,DdlTypeRegistry
    • Field Summary

      Fields 
      Modifier and TypeFieldDescription
      static intARRAY
      A type code representing the generic SQL typeARRAY.
      static intBIGINT
      A type code representing the generic SQL typeBIGINT.
      static intBINARY
      A type code representing the generic SQL typeBINARY.
      static intBIT
      A type code representing generic SQL typeBIT.
      static intBLOB
      A type code representing the generic SQL typeBLOB.
      static intBOOLEAN
      A type code representing the generic SQL typeBOOLEAN.
      static intCHAR
      A type code representing the generic SQL typeCHAR.
      static intCLOB
      A type code representing the generic SQL typeCLOB.
      static intDATALINK
      A type code representing the generic SQL typeDATALINK.
      static intDATE
      A type code representing the generic SQL typeDATE.
      static intDECIMAL
      A type code representing the generic SQL typeDECIMAL.
      static intDISTINCT
      A type code representing the generic SQL typeDISTINCT.
      static intDOUBLE
      A type code representing the generic SQL typeDOUBLE.
      static intDURATION
      A type code representing a "virtual mapping" ofDuration.
      static intENUM
      A type code representing a SQLENUM type for databases likeMySQL whereENUM types do not have names.
      static intFLOAT
      A type code representing the generic SQL typeFLOAT.
      static intGEOGRAPHY
      A type code representing the generic SQL typeGEOGRAPHY.
      static intGEOMETRY
      A type code representing the generic SQL typeGEOMETRY.
      static intINET
      A type code representing the generic SQL typeINET for IPv4 or IPv6 addresses.
      static intINSTANT
      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 intINTEGER
      A type code representing the generic SQL typeINTEGER.
      static intINTERVAL_SECOND
      A type code representing the generic SQL typeINTERVAL SECOND for a temporal duration given terms of seconds and fractional seconds.
      static intJAVA_OBJECT
      A type code representing the generic SQL typeJAVA_OBJECT.
      static intJSON
      A type code representing the generic SQL typeJSON.
      static intJSON_ARRAY
      A type code for an array of json objects.
      static intLOCAL_DATE
      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 intLOCAL_DATE_TIME
      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 intLOCAL_TIME
      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 intLONG32NVARCHAR
      A type code used internally by the HibernateDialect to identify anNVARCHAR-like type large enough to hold any Java string.
      static intLONG32VARBINARY
      A type code used by the Hibernate SQLdialect to identify aVARBINARY-like type large enough to hold any Java byte array.
      static intLONG32VARCHAR
      A type code used internally by the HibernateDialect to identify aVARCHAR-like type large enough to hold any Java string.
      static intLONGNVARCHAR
      A type code representing the generic SQL typeLONGNVARCHAR.
      static intLONGVARBINARY
      A type code representing the generic SQL typeLONGVARBINARY.
      static intLONGVARCHAR
      A type code representing the generic SQL typeLONGVARCHAR.
      static intMATERIALIZED_BLOB
      The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL typeMATERIALIZED_BLOB.
      static intMATERIALIZED_CLOB
      The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL typeMATERIALIZED_CLOB.
      static intMATERIALIZED_NCLOB
      The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL typeMATERIALIZED_NCLOB.
      static intNAMED_ENUM
      A type code representing a SQLENUM type for databases likePostgreSQL whereENUM types must have names.
      static intNAMED_ORDINAL_ENUM
      A type code representing a SQLENUM type for databases likePostgreSQL whereENUM types must have names.
      static intNCHAR
      A type code representing the generic SQL typeNCHAR.
      static intNCLOB
      A type code representing the generic SQL typeNCLOB.
      static intNULL
      A type code representing the generic SQL valueNULL.
      static intNUMERIC
      A type code representing the generic SQL typeNUMERIC.
      static intNVARCHAR
      A type code representing the generic SQL typeNVARCHAR.
      static intOFFSET_DATE_TIME
      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 intOFFSET_TIME
      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 intORDINAL_ENUM
      A type code representing a SQLENUM type for databases likeMySQL whereENUM types do not have names.
      static intOTHER
      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 intPOINT
      A type code representing the generic SQL typePOINT.
      static intREAL
      A type code representing the generic SQL typeREAL.
      static intREF
      A type code representing the generic SQL typeREF.
      static intREF_CURSOR
      A type code representing the generic SQL typeREF CURSOR.
      static intROWID
      A type code representing the generic SQL typeROWID.
      static intSMALLINT
      A type code representing the generic SQL typeSMALLINT.
      static intSQLXML
      A type code representing the generic SQL typeXML.
      static intSTRUCT
      A type code representing the generic SQL typeSTRUCT.
      static intSTRUCT_ARRAY
      A type code for an array of struct objects.
      static intSTRUCT_TABLE
      A type code representing an Oracle-style nested table for a struct.
      static intTABLE
      A type code representing an Oracle-style nested table.
      static intTIME
      A type code representing the generic SQL typeTIME.
      static intTIME_UTC
      A type code representing the generic SQL typeTIME, where the value is given in UTC, instead of in the system orJDBC timezone.
      static intTIME_WITH_TIMEZONE
      A type code representing identifies the generic SQL typeTIME WITH TIMEZONE.
      static intTIMESTAMP
      A type code representing the generic SQL typeTIMESTAMP.
      static intTIMESTAMP_UTC
      A type code representing the generic SQL typeTIMESTAMP, where the value is given in UTC, instead of in the system orJDBC timezone.
      static intTIMESTAMP_WITH_TIMEZONE
      A type code representing the generic SQL typeTIMESTAMP WITH TIMEZONE.
      static intTINYINT
      A type code representing the generic SQL typeTINYINT.
      static intUUID
      A type code representing the generic SQL typeUUID.
      static intVARBINARY
      A type code representing the generic SQL typeVARBINARY.
      static intVARCHAR
      A type code representing the generic SQL typeVARCHAR.
      static intVECTOR
      A type code representing anembedding vector type for databases likePostgreSQL,Oracle 23ai andMariaDB.
      static intVECTOR_FLOAT32
      A type code representing a single-precision floating-point vector type for oracle 23ai database.
      static intVECTOR_FLOAT64
      A type code representing a double-precision floating-point type for oracle 23ai database.
      static intVECTOR_INT8
      A type code representing a single-byte integer vector type for oracle 23ai database.
      static intXML_ARRAY
      A type code for an array of xml objects.
      static intZONED_DATE_TIME
      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

      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static 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 aduration type?
      static booleanisEnumType​(int typeCode) 
      static booleanisFloatOrRealOrDouble​(int typeCode)
      Does the given typecode represent a SQL floating point type?
      static booleanisIntegral​(int typeCode)
      Does the given typecode represent a SQL integer type?
      static booleanisIntervalType​(int typeCode)
      Does the given typecode represent a SQLinterval 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?