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-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 SQL
Dialect, 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 a
JdbcType, by implementors ofJavaType.getRecommendedJdbcType(org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators), or when the@JdbcTypeCodeannotation is used, for example.A type code may also be used as a key to obtain a dialect-specific
DdlTypefor the purposes of generating DDL.- See Also:
JdbcTypeRegistry,DdlTypeRegistry
-
-
Field Summary
Fields Modifier and Type Field Description static intARRAYA type code representing the generic SQL typeARRAY.static intBIGINTA type code representing the generic SQL typeBIGINT.static intBINARYA type code representing the generic SQL typeBINARY.static intBITA type code representing generic SQL typeBIT.static intBLOBA type code representing the generic SQL typeBLOB.static intBOOLEANA type code representing the generic SQL typeBOOLEAN.static intCHARA type code representing the generic SQL typeCHAR.static intCLOBA type code representing the generic SQL typeCLOB.static intDATALINKA type code representing the generic SQL typeDATALINK.static intDATEA type code representing the generic SQL typeDATE.static intDECIMALA type code representing the generic SQL typeDECIMAL.static intDISTINCTA type code representing the generic SQL typeDISTINCT.static intDOUBLEA type code representing the generic SQL typeDOUBLE.static intDURATIONA type code representing a "virtual mapping" of Duration.static intENUMA type code representing a SQLENUMtype for databases likeMySQLwhereENUMtypes do not have names.static intFLOATA type code representing the generic SQL typeFLOAT.static intGEOGRAPHYA type code representing the generic SQL typeGEOGRAPHY.static intGEOMETRYA type code representing the generic SQL typeGEOMETRY.static intINETA type code representing the generic SQL typeINETfor IPv4 or IPv6 addresses.static intINTEGERA type code representing the generic SQL typeINTEGER.static intINTERVAL_SECONDA type code representing the generic SQL typeINTERVAL SECONDfor a temporal duration given terms of seconds and fractional seconds.static intJAVA_OBJECTA type code representing the generic SQL typeJAVA_OBJECT.static intJSONA type code representing the generic SQL typeJSON.static intLONG32NVARCHARstatic intLONG32VARBINARYstatic intLONG32VARCHARstatic intLONGNVARCHARA type code representing the generic SQL typeLONGNVARCHAR.static intLONGVARBINARYA type code representing the generic SQL typeLONGVARBINARY.static intLONGVARCHARA type code representing the generic SQL typeLONGVARCHAR.static intMATERIALIZED_BLOBThe constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL typeMATERIALIZED_BLOB.static intMATERIALIZED_CLOBThe constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL typeMATERIALIZED_CLOB.static intMATERIALIZED_NCLOBThe constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL typeMATERIALIZED_NCLOB.static intNAMED_ENUMA type code representing a SQLENUMtype for databases likePostgreSQLwhereENUMtypes must have names.static intNCHARA type code representing the generic SQL typeNCHAR.static intNCLOBA type code representing the generic SQL typeNCLOB.static intNULLA type code representing the generic SQL valueNULL.static intNUMERICA type code representing the generic SQL typeNUMERIC.static intNVARCHARA type code representing the generic SQL typeNVARCHAR.static intOTHERA 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 intPOINTA type code representing the generic SQL typePOINT.static intREALA type code representing the generic SQL typeREAL.static intREFA type code representing the generic SQL typeREF.static intREF_CURSORA type code representing the generic SQL typeREF CURSOR.static intROWIDA type code representing the generic SQL typeROWID.static intSMALLINTA type code representing the generic SQL typeSMALLINT.static intSQLXMLA type code representing the generic SQL typeXML.static intSTRUCTA type code representing the generic SQL typeSTRUCT.static intTABLEA type code representing an Oracle-style nested table.static intTIMEA type code representing the generic SQL typeTIME.static intTIME_UTCA type code representing the generic SQL typeTIME, where the value is given in UTC, instead of in the system or JDBC timezone.static intTIME_WITH_TIMEZONEA type code representing identifies the generic SQL typeTIME WITH TIMEZONE.static intTIMESTAMPA type code representing the generic SQL typeTIMESTAMP.static intTIMESTAMP_UTCA type code representing the generic SQL typeTIMESTAMP, where the value is given in UTC, instead of in the system or JDBC timezone.static intTIMESTAMP_WITH_TIMEZONEA type code representing the generic SQL typeTIMESTAMP WITH TIMEZONE.static intTINYINTA type code representing the generic SQL typeTINYINT.static intUUIDA type code representing the generic SQL typeUUID.static intVARBINARYA type code representing the generic SQL typeVARBINARY.static intVARCHARA type code representing the generic SQL typeVARCHAR.static intVECTORA type code representing anembedding vectortype for databases likePostgreSQLthat have special extensions.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 adurationtype?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 SQLintervaltype?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?
-
-
-
Field Detail
-
BIT
public static final int BIT
A type code representing generic SQL typeBIT.- See Also:
Types.BIT, Constant Field Values
-
TINYINT
public static final int TINYINT
A type code representing the generic SQL typeTINYINT.- See Also:
Types.TINYINT,TinyIntJdbcType, Constant Field Values
-
SMALLINT
public static final int SMALLINT
A type code representing the generic SQL typeSMALLINT.- See Also:
Types.SMALLINT,SmallIntJdbcType, Constant Field Values
-
INTEGER
public static final int INTEGER
A type code representing the generic SQL typeINTEGER.- See Also:
Types.INTEGER,IntegerJdbcType, Constant Field Values
-
BIGINT
public static final int BIGINT
A type code representing the generic SQL typeBIGINT.- See Also:
Types.BIGINT,BigIntJdbcType, Constant Field Values
-
FLOAT
public static final int FLOAT
A type code representing the generic SQL typeFLOAT.- See Also:
Types.FLOAT,FloatJdbcType, Constant Field Values
-
REAL
public static final int REAL
A type code representing the generic SQL typeREAL.- See Also:
Types.REAL,RealJdbcType, Constant Field Values
-
DOUBLE
public static final int DOUBLE
A type code representing the generic SQL typeDOUBLE.- See Also:
Types.DOUBLE,DoubleJdbcType, Constant Field Values
-
NUMERIC
public static final int NUMERIC
A type code representing the generic SQL typeNUMERIC.- See Also:
Types.NUMERIC,NumericJdbcType, Constant Field Values
-
DECIMAL
public static final int DECIMAL
A type code representing the generic SQL typeDECIMAL.- See Also:
Types.DECIMAL,DecimalJdbcType, Constant Field Values
-
CHAR
public static final int CHAR
A type code representing the generic SQL typeCHAR.- See Also:
Types.CHAR,CharJdbcType, Constant Field Values
-
VARCHAR
public static final int VARCHAR
A type code representing the generic SQL typeVARCHAR.- See Also:
Types.VARCHAR,VarcharJdbcType, Constant Field Values
-
LONGVARCHAR
public static final int LONGVARCHAR
A 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 LONG32VARCHAR
A 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 length 2147483647, though this is not an absolutely hard requirement, since such large strings do not occur in practice.
- See Also:
Length.LONG32, Constant Field Values
-
DATE
public static final int DATE
A type code representing the generic SQL typeDATE.- See Also:
Types.DATE,DateJdbcType, Constant Field Values
-
TIME
public static final int TIME
A type code representing the generic SQL typeTIME.- See Also:
Types.TIME,TimeJdbcType, Constant Field Values
-
TIMESTAMP
public static final int TIMESTAMP
A type code representing the generic SQL typeTIMESTAMP.- See Also:
Types.TIMESTAMP,TimestampJdbcType, Constant Field Values
-
BINARY
public static final int BINARY
A type code representing the generic SQL typeBINARY.- See Also:
Types.BINARY,BinaryJdbcType, Constant Field Values
-
VARBINARY
public static final int VARBINARY
A type code representing the generic SQL typeVARBINARY.- See Also:
Types.VARBINARY,VarbinaryJdbcType, Constant Field Values
-
LONGVARBINARY
public static final int LONGVARBINARY
A 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 LONG32VARBINARY
A type code used by the Hibernate SQL dialect to identify aVARBINARY-like type large enough to hold any Java byte array.In principle, the type must accommodate arrays of length 2147483647, though this is not an absolutely hard requirement, since such large arrays do not occur in practice.
- See Also:
Length.LONG32, Constant Field Values
-
NULL
public static final int NULL
A type code representing the generic SQL valueNULL.- See Also:
Types.NULL, Constant Field Values
-
OTHER
public static final 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 methodsResultSet.getObject(int)andPreparedStatement.setObject(int, java.lang.Object, int).- See Also:
Types.OTHER, Constant Field Values
-
JAVA_OBJECT
public static final int JAVA_OBJECT
A type code representing the generic SQL typeJAVA_OBJECT.- See Also:
Types.JAVA_OBJECT,ObjectJdbcType, Constant Field Values
-
DISTINCT
public static final int DISTINCT
A type code representing the generic SQL typeDISTINCT.- See Also:
Types.DISTINCT, Constant Field Values
-
STRUCT
public static final int STRUCT
A type code representing the generic SQL typeSTRUCT.- See Also:
Types.STRUCT, Constant Field Values
-
ARRAY
public static final int ARRAY
A type code representing the generic SQL typeARRAY.- See Also:
Types.ARRAY,ArrayJdbcType, Constant Field Values
-
TABLE
public static final int TABLE
A type code representing an Oracle-style nested table.- See Also:
OracleNestedTableJdbcType, Constant Field Values
-
BLOB
public static final int BLOB
A type code representing the generic SQL typeBLOB.- See Also:
Types.BLOB,BlobJdbcType, Constant Field Values
-
CLOB
public static final int CLOB
A type code representing the generic SQL typeCLOB.- See Also:
Types.CLOB,ClobJdbcType, Constant Field Values
-
REF
public static final int REF
A type code representing the generic SQL typeREF.- See Also:
Types.REF, Constant Field Values
-
DATALINK
public static final int DATALINK
A type code representing the generic SQL typeDATALINK.- See Also:
Types.DATALINK, Constant Field Values
-
BOOLEAN
public static final int BOOLEAN
A type code representing the generic SQL typeBOOLEAN.
-
ROWID
public static final int ROWID
A type code representing the generic SQL typeROWID.- See Also:
Types.ROWID, Constant Field Values
-
NCHAR
public static final int NCHAR
A type code representing the generic SQL typeNCHAR.- See Also:
Types.NCHAR,NCharJdbcType, Constant Field Values
-
NVARCHAR
public static final int NVARCHAR
A type code representing the generic SQL typeNVARCHAR.- See Also:
Types.NVARCHAR,NVarcharJdbcType, Constant Field Values
-
LONGNVARCHAR
public static final int LONGNVARCHAR
A 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 LONG32NVARCHAR
A 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 length 2147483647, though this is not an absolutely hard requirement, since such large strings do not occur in practice.
- See Also:
Length.LONG32, Constant Field Values
-
NCLOB
public static final int NCLOB
A type code representing the generic SQL typeNCLOB.- See Also:
Types.NCLOB,NClobJdbcType, Constant Field Values
-
SQLXML
public static final int SQLXML
A type code representing the generic SQL typeXML.- See Also:
Types.SQLXML,XmlJdbcType, Constant Field Values
-
REF_CURSOR
public static final int REF_CURSOR
A type code representing the generic SQL typeREF CURSOR.- See Also:
Types.REF_CURSOR, Constant Field Values
-
TIME_WITH_TIMEZONE
public static final int TIME_WITH_TIMEZONE
A type code representing identifies the generic SQL typeTIME WITH TIMEZONE.- See Also:
Types.TIME_WITH_TIMEZONE, Constant Field Values
-
TIMESTAMP_WITH_TIMEZONE
public static final int TIMESTAMP_WITH_TIMEZONE
A type code representing the generic SQL typeTIMESTAMP WITH TIMEZONE.
-
UUID
public static final int UUID
A type code representing the generic SQL typeUUID.
-
JSON
public static final int JSON
A type code representing the generic SQL typeJSON.- See Also:
JsonJdbcType, Constant Field Values
-
INET
public static final int INET
A type code representing the generic SQL typeINETfor IPv4 or IPv6 addresses.- See Also:
PostgreSQLInetJdbcType, Constant Field Values
-
TIMESTAMP_UTC
public static final int TIMESTAMP_UTC
A type code representing the generic SQL typeTIMESTAMP, where the value is given in UTC, instead of in the system or JDBC timezone.
-
MATERIALIZED_BLOB
@Internal public static final int 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:
- Constant Field Values
-
MATERIALIZED_CLOB
@Internal public static final int 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:
- Constant Field Values
-
MATERIALIZED_NCLOB
@Internal public static final int 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:
- Constant Field Values
-
TIME_UTC
public static final int TIME_UTC
A type code representing the generic SQL typeTIME, where the value is given in UTC, instead of in the system or JDBC timezone.
-
DURATION
public static final int DURATION
A type code representing a "virtual mapping" of Duration.- See Also:
Types.NUMERIC,DurationJdbcType, Constant Field Values
-
INTERVAL_SECOND
public static final int INTERVAL_SECOND
A type code representing the generic SQL typeINTERVAL SECONDfor a temporal duration given terms of seconds and fractional seconds.
-
GEOMETRY
public static final int GEOMETRY
A type code representing the generic SQL typeGEOMETRY.- See Also:
- Constant Field Values
-
POINT
public static final int POINT
A type code representing the generic SQL typePOINT.- See Also:
- Constant Field Values
-
GEOGRAPHY
public static final int GEOGRAPHY
A type code representing the generic SQL typeGEOGRAPHY.- Since:
- 6.0.1
- See Also:
- Constant Field Values
-
ENUM
public static final int ENUM
A type code representing a SQLENUMtype for databases likeMySQLwhereENUMtypes do not have names.- Since:
- 6.3
- See Also:
MySQLEnumJdbcType, Constant Field Values
-
NAMED_ENUM
public static final int NAMED_ENUM
A type code representing a SQLENUMtype for databases likePostgreSQLwhereENUMtypes must have names.- Since:
- 6.3
- See Also:
PostgreSQLEnumJdbcType, Constant Field Values
-
VECTOR
public static final int VECTOR
A type code representing anembedding vectortype for databases likePostgreSQLthat have special extensions. An embedding vector essentially is afloat[]with a fixed size.- Since:
- 6.4
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
@Internal public static boolean isSmallOrTinyInt(int typeCode)
-
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)
-
-