Class SqlTypes


  • public class SqlTypes
    extends Object
    Defines a list of constant type codes used to identify generic SQL types. This is an extension of the standard JDBC-defined 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:
    JdbcTypeRegistry, DdlTypeRegistry
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ARRAY
      A type code representing the generic SQL type ARRAY.
      static int BIGINT
      A type code representing the generic SQL type BIGINT.
      static int BINARY
      A type code representing the generic SQL type BINARY.
      static int BIT
      A type code representing generic SQL type BIT.
      static int BLOB
      A type code representing the generic SQL type BLOB.
      static int BOOLEAN
      A type code representing the generic SQL type BOOLEAN.
      static int CHAR
      A type code representing the generic SQL type CHAR.
      static int CLOB
      A type code representing the generic SQL type CLOB.
      static int DATALINK
      A type code representing the generic SQL type DATALINK.
      static int DATE
      A type code representing the generic SQL type DATE.
      static int DECIMAL
      A type code representing the generic SQL type DECIMAL.
      static int DISTINCT
      A type code representing the generic SQL type DISTINCT.
      static int DOUBLE
      A type code representing the generic SQL type DOUBLE.
      static int DURATION
      A type code representing a "virtual mapping" of Duration.
      static int ENUM
      A type code representing a SQL ENUM type for databases like MySQL where ENUM types do not have names.
      static int FLOAT
      A type code representing the generic SQL type FLOAT.
      static int GEOGRAPHY
      A type code representing the generic SQL type GEOGRAPHY.
      static int GEOMETRY
      A type code representing the generic SQL type GEOMETRY.
      static int INET
      A type code representing the generic SQL type INET for IPv4 or IPv6 addresses.
      static int INTEGER
      A type code representing the generic SQL type INTEGER.
      static int INTERVAL_SECOND
      A type code representing the generic SQL type INTERVAL SECOND for a temporal duration given terms of seconds and fractional seconds.
      static int JAVA_OBJECT
      A type code representing the generic SQL type JAVA_OBJECT.
      static int JSON
      A type code representing the generic SQL type JSON.
      static int LONG32NVARCHAR
      A type code used internally by the Hibernate Dialect to identify an NVARCHAR-like type large enough to hold any Java string.
      static int LONG32VARBINARY
      A type code used by the Hibernate SQL dialect to identify a VARBINARY-like type large enough to hold any Java byte array.
      static int LONG32VARCHAR
      A type code used internally by the Hibernate Dialect to identify a VARCHAR-like type large enough to hold any Java string.
      static int LONGNVARCHAR
      A type code representing the generic SQL type LONGNVARCHAR.
      static int LONGVARBINARY
      A type code representing the generic SQL type LONGVARBINARY.
      static int LONGVARCHAR
      A type code representing the generic SQL type LONGVARCHAR.
      static int MATERIALIZED_BLOB
      The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type MATERIALIZED_BLOB.
      static int MATERIALIZED_CLOB
      The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type MATERIALIZED_CLOB.
      static int MATERIALIZED_NCLOB
      The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type MATERIALIZED_NCLOB.
      static int NAMED_ENUM
      A type code representing a SQL ENUM type for databases like PostgreSQL where ENUM types must have names.
      static int NCHAR
      A type code representing the generic SQL type NCHAR.
      static int NCLOB
      A type code representing the generic SQL type NCLOB.
      static int NULL
      A type code representing the generic SQL value NULL.
      static int NUMERIC
      A type code representing the generic SQL type NUMERIC.
      static int NVARCHAR
      A type code representing the generic SQL type NVARCHAR.
      static int OTHER
      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 methods ResultSet.getObject(int) and PreparedStatement.setObject(int, java.lang.Object, int).
      static int POINT
      A type code representing the generic SQL type POINT.
      static int REAL
      A type code representing the generic SQL type REAL.
      static int REF
      A type code representing the generic SQL type REF.
      static int REF_CURSOR
      A type code representing the generic SQL type REF CURSOR.
      static int ROWID
      A type code representing the generic SQL type ROWID.
      static int SMALLINT
      A type code representing the generic SQL type SMALLINT.
      static int SQLXML
      A type code representing the generic SQL type XML.
      static int STRUCT
      A type code representing the generic SQL type STRUCT.
      static int TABLE
      A type code representing an Oracle-style nested table.
      static int TIME
      A type code representing the generic SQL type TIME.
      static int TIME_UTC
      A type code representing the generic SQL type TIME, where the value is given in UTC, instead of in the system or JDBC timezone.
      static int TIME_WITH_TIMEZONE
      A type code representing identifies the generic SQL type TIME WITH TIMEZONE.
      static int TIMESTAMP
      A type code representing the generic SQL type TIMESTAMP.
      static int TIMESTAMP_UTC
      A type code representing the generic SQL type TIMESTAMP, where the value is given in UTC, instead of in the system or JDBC timezone.
      static int TIMESTAMP_WITH_TIMEZONE
      A type code representing the generic SQL type TIMESTAMP WITH TIMEZONE.
      static int TINYINT
      A type code representing the generic SQL type TINYINT.
      static int UUID
      A type code representing the generic SQL type UUID.
      static int VARBINARY
      A type code representing the generic SQL type VARBINARY.
      static int VARCHAR
      A type code representing the generic SQL type VARCHAR.
      static int VECTOR
      A type code representing an embedding vector type for databases like PostgreSQL that have special extensions.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      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 a duration 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 SQL interval 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?