Class SqlTypes

java.lang.Object
org.hibernate.type.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:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    A type code representing the generic SQL type ARRAY.
    static final int
    A type code representing the generic SQL type BIGINT.
    static final int
    A type code representing the generic SQL type BINARY.
    static final int
    A type code representing generic SQL type BIT.
    static final int
    A type code representing the generic SQL type BLOB.
    static final int
    A type code representing the generic SQL type BOOLEAN.
    static final int
    A type code representing the generic SQL type CHAR.
    static final int
    A type code representing the generic SQL type CLOB.
    static final int
    A type code representing the generic SQL type DATALINK.
    static final int
    A type code representing the generic SQL type DATE.
    static final int
    A type code representing the generic SQL type DECIMAL.
    static final int
    A type code representing the generic SQL type DISTINCT.
    static final int
    A type code representing the generic SQL type DOUBLE.
    static final int
    A type code representing a "virtual mapping" of Duration.
    static final int
    A type code representing a SQL ENUM type for databases like MySQL where ENUM types do not have names.
    static final int
    A type code representing the generic SQL type FLOAT.
    static final int
    A type code representing the generic SQL type GEOGRAPHY.
    static final int
    A type code representing the generic SQL type GEOMETRY.
    static final int
    A type code representing the generic SQL type INET 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 type INTEGER.
    static final int
    A type code representing the generic SQL type INTERVAL SECOND for a temporal duration given terms of seconds and fractional seconds.
    static final int
    A type code representing the generic SQL type JAVA_OBJECT.
    static final int
    A type code representing the generic SQL type JSON.
    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
    A type code used internally by the Hibernate Dialect to identify an NVARCHAR-like type large enough to hold any Java string.
    static final int
    A type code used by the Hibernate SQL dialect to identify a VARBINARY-like type large enough to hold any Java byte array.
    static final int
    A type code used internally by the Hibernate Dialect to identify a VARCHAR-like type large enough to hold any Java string.
    static final int
    A type code representing the generic SQL type LONGNVARCHAR.
    static final int
    A type code representing the generic SQL type LONGVARBINARY.
    static final int
    A type code representing the generic SQL type LONGVARCHAR.
    static final int
    The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type MATERIALIZED_BLOB.
    static final int
    The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type MATERIALIZED_CLOB.
    static final int
    The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type MATERIALIZED_NCLOB.
    static final int
    A type code representing a SQL ENUM type for databases like PostgreSQL where ENUM types must have names.
    static final int
    A type code representing a SQL ENUM type for databases like PostgreSQL where ENUM types must have names.
    static final int
    A type code representing the generic SQL type NCHAR.
    static final int
    A type code representing the generic SQL type NCLOB.
    static final int
    A type code representing the generic SQL value NULL.
    static final int
    A type code representing the generic SQL type NUMERIC.
    static final int
    A type code representing the generic SQL type NVARCHAR.
    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 SQL ENUM type for databases like MySQL where ENUM 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 methods ResultSet.getObject(int) and PreparedStatement.setObject(int, java.lang.Object, int).
    static final int
    A type code representing the generic SQL type POINT.
    static final int
    A type code representing the generic SQL type REAL.
    static final int
    A type code representing the generic SQL type REF.
    static final int
    A type code representing the generic SQL type REF CURSOR.
    static final int
    A type code representing the generic SQL type ROWID.
    static final int
    A type code representing the generic SQL type SMALLINT.
    static final int
    A type code representing the generic SQL type XML.
    static final int
    A type code representing the generic SQL type STRUCT.
    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 type TIME.
    static final int
    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 final int
    A type code representing identifies the generic SQL type TIME WITH TIMEZONE.
    static final int
    A type code representing the generic SQL type TIMESTAMP.
    static final int
    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 final int
    A type code representing the generic SQL type TIMESTAMP WITH TIMEZONE.
    static final int
    A type code representing the generic SQL type TINYINT.
    static final int
    A type code representing the generic SQL type UUID.
    static final int
    A type code representing the generic SQL type VARBINARY.
    static final int
    A type code representing the generic SQL type VARCHAR.
    static final int
    A type code representing an embedding vector type for databases like PostgreSQL and Oracle 23ai.
    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 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?

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait