some cleanups + doc for SqlTypes
This commit is contained in:
parent
5dfb90bb73
commit
77a1be10b1
|
@ -42,7 +42,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
* <p/>
|
* <p/>
|
||||||
* This code is generally as one of the values defined in {@link java.sql.Types}, but are not
|
* This code is generally as one of the values defined in {@link java.sql.Types}, but are not
|
||||||
* limited to these. The code is resolved against an internal registry of {@link JdbcType}
|
* limited to these. The code is resolved against an internal registry of {@link JdbcType}
|
||||||
* references. See the user-guide for additional details.
|
* references. See the user guide for additional details.
|
||||||
* <p/>
|
* <p/>
|
||||||
* See <a href="package-summary.html#basic-value-mapping"/> for high-level discussion
|
* See <a href="package-summary.html#basic-value-mapping"/> for high-level discussion
|
||||||
* of basic value mapping.
|
* of basic value mapping.
|
||||||
|
@ -61,8 +61,8 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
public @interface JdbcTypeCode {
|
public @interface JdbcTypeCode {
|
||||||
/**
|
/**
|
||||||
* The standard {@linkplain java.sql.Types JDBC Types} code or a custom code.
|
* The standard {@linkplain java.sql.Types JDBC Types} code or a custom code.
|
||||||
* This ultimately decides which {@link JdbcType}
|
* This ultimately decides which {@link JdbcType} is used to "understand" the
|
||||||
* is used to "understand" the described SQL data type
|
* described SQL data type.
|
||||||
*/
|
*/
|
||||||
int value();
|
int value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,71 +9,71 @@ package org.hibernate.type;
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class that defines the constants that are used to identify generic
|
* Defines a list of constant type codes used to identify generic SQL types.
|
||||||
* SQL types. This is an extension of {@link Types} that provides type codes
|
* This is an extension of the standard JDBC-defined {@link Types}, defining
|
||||||
* for types that Hibernate supports in addition to the standard JDBC types.
|
* additional type codes for types that Hibernate supports but which are not
|
||||||
|
* recognized by the JDBC specification.
|
||||||
|
* <p>
|
||||||
|
* Each of these type codes represents an abstraction over a family of
|
||||||
|
* similar types in different databases. It's the job of the SQL
|
||||||
|
* {@link org.hibernate.dialect.Dialect}, and in particular of the method
|
||||||
|
* {@code columnType()}, to interpret these type codes as column type names.
|
||||||
|
* <p>
|
||||||
|
* A type code is often used as a key to obtain a
|
||||||
|
* {@link org.hibernate.type.descriptor.jdbc.JdbcType}, by implementors of
|
||||||
|
* {@link org.hibernate.type.descriptor.java.JavaType#getRecommendedJdbcType},
|
||||||
|
* or when the {@link org.hibernate.annotations.JdbcTypeCode @JdbcTypeCode}
|
||||||
|
* annotation is used, for example.
|
||||||
|
*
|
||||||
|
* @see org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry
|
||||||
*
|
*
|
||||||
* @author Christian Beikov
|
* @author Christian Beikov
|
||||||
*/
|
*/
|
||||||
public class SqlTypes {
|
public class SqlTypes {
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing generic SQL type {@code BIT}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code BIT}.
|
|
||||||
*
|
*
|
||||||
* @see Types#BIT
|
* @see Types#BIT
|
||||||
*/
|
*/
|
||||||
public final static int BIT = Types.BIT;
|
public final static int BIT = Types.BIT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code TINYINT}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code TINYINT}.
|
|
||||||
*
|
*
|
||||||
* @see Types#TINYINT
|
* @see Types#TINYINT
|
||||||
*/
|
*/
|
||||||
public final static int TINYINT = Types.TINYINT;
|
public final static int TINYINT = Types.TINYINT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code SMALLINT}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code SMALLINT}.
|
|
||||||
*
|
*
|
||||||
* @see Types#SMALLINT
|
* @see Types#SMALLINT
|
||||||
*/
|
*/
|
||||||
public final static int SMALLINT = Types.SMALLINT;
|
public final static int SMALLINT = Types.SMALLINT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code INTEGER}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code INTEGER}.
|
|
||||||
*
|
*
|
||||||
* @see Types#INTEGER
|
* @see Types#INTEGER
|
||||||
*/
|
*/
|
||||||
public final static int INTEGER = Types.INTEGER;
|
public final static int INTEGER = Types.INTEGER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code BIGINT}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code BIGINT}.
|
|
||||||
*
|
*
|
||||||
* @see Types#BIGINT
|
* @see Types#BIGINT
|
||||||
*/
|
*/
|
||||||
public final static int BIGINT = Types.BIGINT;
|
public final static int BIGINT = Types.BIGINT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code FLOAT}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code FLOAT}.
|
|
||||||
*
|
*
|
||||||
* @see Types#FLOAT
|
* @see Types#FLOAT
|
||||||
*/
|
*/
|
||||||
public final static int FLOAT = Types.FLOAT;
|
public final static int FLOAT = Types.FLOAT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code REAL}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code REAL}.
|
|
||||||
*
|
*
|
||||||
* @see Types#REAL
|
* @see Types#REAL
|
||||||
*/
|
*/
|
||||||
|
@ -81,54 +81,42 @@ public class SqlTypes {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code DOUBLE}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code DOUBLE}.
|
|
||||||
*
|
*
|
||||||
* @see Types#DOUBLE
|
* @see Types#DOUBLE
|
||||||
*/
|
*/
|
||||||
public final static int DOUBLE = Types.DOUBLE;
|
public final static int DOUBLE = Types.DOUBLE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code NUMERIC}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code NUMERIC}.
|
|
||||||
*
|
*
|
||||||
* @see Types#NUMERIC
|
* @see Types#NUMERIC
|
||||||
*/
|
*/
|
||||||
public final static int NUMERIC = Types.NUMERIC;
|
public final static int NUMERIC = Types.NUMERIC;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code DECIMAL}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code DECIMAL}.
|
|
||||||
*
|
*
|
||||||
* @see Types#DECIMAL
|
* @see Types#DECIMAL
|
||||||
*/
|
*/
|
||||||
public final static int DECIMAL = Types.DECIMAL;
|
public final static int DECIMAL = Types.DECIMAL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code CHAR}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code CHAR}.
|
|
||||||
*
|
*
|
||||||
* @see Types#CHAR
|
* @see Types#CHAR
|
||||||
*/
|
*/
|
||||||
public final static int CHAR = Types.CHAR;
|
public final static int CHAR = Types.CHAR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code VARCHAR}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code VARCHAR}.
|
|
||||||
*
|
*
|
||||||
* @see Types#VARCHAR
|
* @see Types#VARCHAR
|
||||||
*/
|
*/
|
||||||
public final static int VARCHAR = Types.VARCHAR;
|
public final static int VARCHAR = Types.VARCHAR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code LONGVARCHAR}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code LONGVARCHAR}.
|
|
||||||
* <p>
|
* <p>
|
||||||
* Interpreted by Hibernate as a {@link #VARCHAR}-like type large enough
|
* Interpreted by Hibernate as a {@link #VARCHAR}-like type large enough
|
||||||
* to hold a string of maximum length {@link org.hibernate.Length#LONG}.
|
* to hold a string of maximum length {@link org.hibernate.Length#LONG}.
|
||||||
|
@ -149,54 +137,42 @@ public class SqlTypes {
|
||||||
public final static int LONG32VARCHAR = 4001;
|
public final static int LONG32VARCHAR = 4001;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code DATE}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code DATE}.
|
|
||||||
*
|
*
|
||||||
* @see Types#DATE
|
* @see Types#DATE
|
||||||
*/
|
*/
|
||||||
public final static int DATE = Types.DATE;
|
public final static int DATE = Types.DATE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code TIME}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code TIME}.
|
|
||||||
*
|
*
|
||||||
* @see Types#TIME
|
* @see Types#TIME
|
||||||
*/
|
*/
|
||||||
public final static int TIME = Types.TIME;
|
public final static int TIME = Types.TIME;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code TIMESTAMP}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code TIMESTAMP}.
|
|
||||||
*
|
*
|
||||||
* @see Types#TIMESTAMP
|
* @see Types#TIMESTAMP
|
||||||
*/
|
*/
|
||||||
public final static int TIMESTAMP = Types.TIMESTAMP;
|
public final static int TIMESTAMP = Types.TIMESTAMP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code BINARY}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code BINARY}.
|
|
||||||
*
|
*
|
||||||
* @see Types#BINARY
|
* @see Types#BINARY
|
||||||
*/
|
*/
|
||||||
public final static int BINARY = Types.BINARY;
|
public final static int BINARY = Types.BINARY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code VARBINARY}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code VARBINARY}.
|
|
||||||
*
|
*
|
||||||
* @see Types#VARBINARY
|
* @see Types#VARBINARY
|
||||||
*/
|
*/
|
||||||
public final static int VARBINARY = Types.VARBINARY;
|
public final static int VARBINARY = Types.VARBINARY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language, sometimes referred
|
* A type code representing the generic SQL type {@code LONGVARBINARY}.
|
||||||
* to as a type code, that identifies the generic SQL type
|
|
||||||
* {@code LONGVARBINARY}.
|
|
||||||
* <p>
|
* <p>
|
||||||
* Interpreted by Hibernate as a {@link #VARBINARY}-like type large enough
|
* Interpreted by Hibernate as a {@link #VARBINARY}-like type large enough
|
||||||
* to hold a byte array of maximum length {@link org.hibernate.Length#LONG}.
|
* to hold a byte array of maximum length {@link org.hibernate.Length#LONG}.
|
||||||
|
@ -208,8 +184,8 @@ public class SqlTypes {
|
||||||
public final static int LONGVARBINARY = Types.LONGVARBINARY;
|
public final static int LONGVARBINARY = Types.LONGVARBINARY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A type code used internally by the Hibernate
|
* A type code used internally by the Hibernate SQL
|
||||||
* {@link org.hibernate.dialect.Dialect} to identify a
|
* {@linkplain org.hibernate.dialect.Dialect dialect} to identify a
|
||||||
* {@link #VARBINARY}-like type large enough to hold any Java byte array.
|
* {@link #VARBINARY}-like type large enough to hold any Java byte array.
|
||||||
*
|
*
|
||||||
* @see org.hibernate.Length#LONG32
|
* @see org.hibernate.Length#LONG32
|
||||||
|
@ -217,18 +193,16 @@ public class SqlTypes {
|
||||||
public final static int LONG32VARBINARY = 4003;
|
public final static int LONG32VARBINARY = 4003;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <P>The constant in the Java programming language
|
* A type code representing the generic SQL value {@code NULL}.
|
||||||
* that identifies the generic SQL value
|
|
||||||
* {@code NULL}.
|
|
||||||
*
|
*
|
||||||
* @see Types#NULL
|
* @see Types#NULL
|
||||||
*/
|
*/
|
||||||
public final static int NULL = Types.NULL;
|
public final static int NULL = Types.NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language that indicates that the
|
* A type code indicating that the SQL type is SQL dialect-specific
|
||||||
* SQL type is database-specific and is mapped to a Java object that can
|
* and is mapped to a Java object that can be accessed via the methods
|
||||||
* be accessed via the methods {@link java.sql.ResultSet#getObject} and
|
* {@link java.sql.ResultSet#getObject} and
|
||||||
* {@link java.sql.PreparedStatement#setObject}.
|
* {@link java.sql.PreparedStatement#setObject}.
|
||||||
*
|
*
|
||||||
* @see Types#OTHER
|
* @see Types#OTHER
|
||||||
|
@ -236,105 +210,91 @@ public class SqlTypes {
|
||||||
public final static int OTHER = Types.OTHER;
|
public final static int OTHER = Types.OTHER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code JAVA_OBJECT}.
|
||||||
* as a type code, that identifies the generic SQL type
|
|
||||||
* {@code JAVA_OBJECT}.
|
|
||||||
*
|
*
|
||||||
* @see Types#JAVA_OBJECT
|
* @see Types#JAVA_OBJECT
|
||||||
*/
|
*/
|
||||||
public final static int JAVA_OBJECT = Types.JAVA_OBJECT;
|
public final static int JAVA_OBJECT = Types.JAVA_OBJECT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code DISTINCT}.
|
||||||
* as a type code, that identifies the generic SQL type {@code DISTINCT}.
|
|
||||||
*
|
*
|
||||||
* @see Types#DISTINCT
|
* @see Types#DISTINCT
|
||||||
*/
|
*/
|
||||||
public final static int DISTINCT = Types.DISTINCT;
|
public final static int DISTINCT = Types.DISTINCT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code STRUCT}.
|
||||||
* as a type code, that identifies the generic SQL type {@code STRUCT}.
|
|
||||||
*
|
*
|
||||||
* @see Types#STRUCT
|
* @see Types#STRUCT
|
||||||
*/
|
*/
|
||||||
public final static int STRUCT = Types.STRUCT;
|
public final static int STRUCT = Types.STRUCT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code ARRAY}.
|
||||||
* as a type code, that identifies the generic SQL type {@code ARRAY}.
|
|
||||||
*
|
*
|
||||||
* @see Types#ARRAY
|
* @see Types#ARRAY
|
||||||
*/
|
*/
|
||||||
public final static int ARRAY = Types.ARRAY;
|
public final static int ARRAY = Types.ARRAY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code BLOB}.
|
||||||
* as a type code, that identifies the generic SQL type {@code BLOB}.
|
|
||||||
*
|
*
|
||||||
* @see Types#ARRAY
|
* @see Types#ARRAY
|
||||||
*/
|
*/
|
||||||
public final static int BLOB = Types.BLOB;
|
public final static int BLOB = Types.BLOB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code CLOB}.
|
||||||
* as a type code, that identifies the generic SQL type {@code CLOB}.
|
|
||||||
*
|
*
|
||||||
* @see Types#CLOB
|
* @see Types#CLOB
|
||||||
*/
|
*/
|
||||||
public final static int CLOB = Types.CLOB;
|
public final static int CLOB = Types.CLOB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code REF}.
|
||||||
* as a type code, that identifies the generic SQL type {@code REF}.
|
|
||||||
*
|
*
|
||||||
* @see Types#REF
|
* @see Types#REF
|
||||||
*/
|
*/
|
||||||
public final static int REF = Types.REF;
|
public final static int REF = Types.REF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, somtimes referred to
|
* A type code representing the generic SQL type {@code DATALINK}.
|
||||||
* as a type code, that identifies the generic SQL type {@code DATALINK}.
|
|
||||||
*
|
*
|
||||||
* @see Types#DATALINK
|
* @see Types#DATALINK
|
||||||
*/
|
*/
|
||||||
public final static int DATALINK = Types.DATALINK;
|
public final static int DATALINK = Types.DATALINK;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, somtimes referred to
|
* A type code representing the generic SQL type {@code BOOLEAN}.
|
||||||
* as a type code, that identifies the generic SQL type {@code BOOLEAN}.
|
|
||||||
*
|
*
|
||||||
* @see Types#BOOLEAN
|
* @see Types#BOOLEAN
|
||||||
*/
|
*/
|
||||||
public final static int BOOLEAN = Types.BOOLEAN;
|
public final static int BOOLEAN = Types.BOOLEAN;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code ROWID}.
|
||||||
* as a type code, that identifies the generic SQL type {@code ROWID}
|
|
||||||
*
|
*
|
||||||
* @see Types#ROWID
|
* @see Types#ROWID
|
||||||
*/
|
*/
|
||||||
public final static int ROWID = Types.ROWID;
|
public final static int ROWID = Types.ROWID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code NCHAR}.
|
||||||
* as a type code, that identifies the generic SQL type {@code NCHAR}
|
|
||||||
*
|
*
|
||||||
* @see Types#NCHAR
|
* @see Types#NCHAR
|
||||||
*/
|
*/
|
||||||
public static final int NCHAR = Types.NCHAR;
|
public static final int NCHAR = Types.NCHAR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code NVARCHAR}.
|
||||||
* as a type code, that identifies the generic SQL type {@code NVARCHAR}.
|
|
||||||
*
|
*
|
||||||
* @see Types#NVARCHAR
|
* @see Types#NVARCHAR
|
||||||
*/
|
*/
|
||||||
public static final int NVARCHAR = Types.NVARCHAR;
|
public static final int NVARCHAR = Types.NVARCHAR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code LONGNVARCHAR}.
|
||||||
* as a type code, that identifies the generic SQL type {@code LONGNVARCHAR}.
|
|
||||||
* <p>
|
* <p>
|
||||||
* Interpreted by Hibernate as an {@link #NVARCHAR}-like type large enough
|
* Interpreted by Hibernate as an {@link #NVARCHAR}-like type large enough
|
||||||
* to hold a string of maximum length {@link org.hibernate.Length#LONG}.
|
* to hold a string of maximum length {@link org.hibernate.Length#LONG}.
|
||||||
|
@ -355,32 +315,28 @@ public class SqlTypes {
|
||||||
public final static int LONG32NVARCHAR = 4002;
|
public final static int LONG32NVARCHAR = 4002;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code NCLOB}.
|
||||||
* as a type code, that identifies the generic SQL type {@code NCLOB}.
|
|
||||||
*
|
*
|
||||||
* @see Types#NCLOB
|
* @see Types#NCLOB
|
||||||
*/
|
*/
|
||||||
public static final int NCLOB = Types.NCLOB;
|
public static final int NCLOB = Types.NCLOB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code XML}.
|
||||||
* as a type code, that identifies the generic SQL type {@code XML}.
|
|
||||||
*
|
*
|
||||||
* @see Types#SQLXML
|
* @see Types#SQLXML
|
||||||
*/
|
*/
|
||||||
public static final int SQLXML = Types.SQLXML;
|
public static final int SQLXML = Types.SQLXML;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code REF CURSOR}.
|
||||||
* as a type code, that identifies the generic SQL type {@code REF CURSOR}.
|
|
||||||
*
|
*
|
||||||
* @see Types#REF_CURSOR
|
* @see Types#REF_CURSOR
|
||||||
*/
|
*/
|
||||||
public static final int REF_CURSOR = Types.REF_CURSOR;
|
public static final int REF_CURSOR = Types.REF_CURSOR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing identifies the generic SQL type
|
||||||
* as a type code, that identifies the generic SQL type
|
|
||||||
* {@code TIME WITH TIMEZONE}.
|
* {@code TIME WITH TIMEZONE}.
|
||||||
*
|
*
|
||||||
* @see Types#TIME_WITH_TIMEZONE
|
* @see Types#TIME_WITH_TIMEZONE
|
||||||
|
@ -388,8 +344,7 @@ public class SqlTypes {
|
||||||
public static final int TIME_WITH_TIMEZONE = Types.TIME_WITH_TIMEZONE;
|
public static final int TIME_WITH_TIMEZONE = Types.TIME_WITH_TIMEZONE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type
|
||||||
* as a type code, that identifies the generic SQL type
|
|
||||||
* {@code TIMESTAMP WITH TIMEZONE}.
|
* {@code TIMESTAMP WITH TIMEZONE}.
|
||||||
*
|
*
|
||||||
* @see Types#TIMESTAMP_WITH_TIMEZONE
|
* @see Types#TIMESTAMP_WITH_TIMEZONE
|
||||||
|
@ -399,60 +354,53 @@ public class SqlTypes {
|
||||||
// Misc types
|
// Misc types
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code UUID}.
|
||||||
* as a type code, that identifies the generic SQL type {@code UUID}.
|
|
||||||
*
|
*
|
||||||
* @see org.hibernate.cfg.AvailableSettings#PREFERRED_UUID_JDBC_TYPE
|
* @see org.hibernate.cfg.AvailableSettings#PREFERRED_UUID_JDBC_TYPE
|
||||||
*/
|
*/
|
||||||
public static final int UUID = 3000;
|
public static final int UUID = 3000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code JSON}.
|
||||||
* as a type code, that identifies the generic SQL type {@code JSON}.
|
|
||||||
*/
|
*/
|
||||||
public static final int JSON = 3001;
|
public static final int JSON = 3001;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code INET} for IPv4
|
||||||
* as a type code, that identifies the generic SQL type {@code INET}
|
* or IPv6 addresses.
|
||||||
* for IPv4 or IPv6 addresses.
|
|
||||||
*/
|
*/
|
||||||
public static final int INET = 3002;
|
public static final int INET = 3002;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code TIMESTAMP},
|
||||||
* as a type code, that identifies the generic SQL type
|
* where the value is given in UTC, instead of in the system or
|
||||||
* {@code TIMESTAMP_UTC}.
|
* {@linkplain org.hibernate.cfg.AvailableSettings#JDBC_TIME_ZONE
|
||||||
|
* JDBC} timezone.
|
||||||
*/
|
*/
|
||||||
public static final int TIMESTAMP_UTC = 3003;
|
public static final int TIMESTAMP_UTC = 3003;
|
||||||
|
|
||||||
// Interval types
|
// Interval types
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code INTERVAL SECOND}
|
||||||
* as a type code, that identifies the generic SQL type
|
* for a temporal duration given terms of seconds and fractional seconds.
|
||||||
* {@code INTERVAL SECOND} for a temporal amount in terms of seconds and
|
|
||||||
* fractional seconds.
|
|
||||||
*/
|
*/
|
||||||
public static final int INTERVAL_SECOND = 3100;
|
public static final int INTERVAL_SECOND = 3100;
|
||||||
|
|
||||||
// Geometry types
|
// Geometry types
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code GEOMETRY}.
|
||||||
* as a type code, that identifies the generic SQL type {@code GEOMETRY}.
|
|
||||||
*/
|
*/
|
||||||
public static final int GEOMETRY = 3200;
|
public static final int GEOMETRY = 3200;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code POINT}.
|
||||||
* as a type code, that identifies the generic SQL type {@code POINT}.
|
|
||||||
*/
|
*/
|
||||||
public static final int POINT = 3201;
|
public static final int POINT = 3201;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The constant in the Java programming language, sometimes referred to
|
* A type code representing the generic SQL type {@code GEOGRAPHY}.
|
||||||
* as a type code, that identifies the generic SQL type {@code GEOGRAPHY}.
|
|
||||||
*
|
*
|
||||||
* @since 6.0.1
|
* @since 6.0.1
|
||||||
*/
|
*/
|
||||||
|
@ -464,10 +412,10 @@ public class SqlTypes {
|
||||||
/**
|
/**
|
||||||
* Does the given JDBC type code represent some sort of
|
* Does the given JDBC type code represent some sort of
|
||||||
* numeric type?
|
* numeric type?
|
||||||
* @param sqlType a JDBC type code from {@link Types}
|
* @param typeCode a JDBC type code from {@link Types}
|
||||||
*/
|
*/
|
||||||
public static boolean isNumericType(int sqlType) {
|
public static boolean isNumericType(int typeCode) {
|
||||||
switch (sqlType) {
|
switch (typeCode) {
|
||||||
case Types.BIT:
|
case Types.BIT:
|
||||||
case Types.SMALLINT:
|
case Types.SMALLINT:
|
||||||
case Types.TINYINT:
|
case Types.TINYINT:
|
||||||
|
@ -487,10 +435,10 @@ public class SqlTypes {
|
||||||
/**
|
/**
|
||||||
* Does the given JDBC type code represent some sort of
|
* Does the given JDBC type code represent some sort of
|
||||||
* character string type?
|
* character string type?
|
||||||
* @param sqlType a JDBC type code from {@link Types}
|
* @param typeCode a JDBC type code from {@link Types}
|
||||||
*/
|
*/
|
||||||
public static boolean isCharacterOrClobType(int sqlType) {
|
public static boolean isCharacterOrClobType(int typeCode) {
|
||||||
switch (sqlType) {
|
switch (typeCode) {
|
||||||
case Types.CHAR:
|
case Types.CHAR:
|
||||||
case Types.VARCHAR:
|
case Types.VARCHAR:
|
||||||
case Types.LONGVARCHAR:
|
case Types.LONGVARCHAR:
|
||||||
|
@ -508,10 +456,10 @@ public class SqlTypes {
|
||||||
/**
|
/**
|
||||||
* Does the given JDBC type code represent some sort of
|
* Does the given JDBC type code represent some sort of
|
||||||
* character string type?
|
* character string type?
|
||||||
* @param sqlType a JDBC type code from {@link Types}
|
* @param typeCode a JDBC type code from {@link Types}
|
||||||
*/
|
*/
|
||||||
public static boolean isCharacterType(int sqlType) {
|
public static boolean isCharacterType(int typeCode) {
|
||||||
switch (sqlType) {
|
switch (typeCode) {
|
||||||
case Types.CHAR:
|
case Types.CHAR:
|
||||||
case Types.VARCHAR:
|
case Types.VARCHAR:
|
||||||
case Types.LONGVARCHAR:
|
case Types.LONGVARCHAR:
|
||||||
|
@ -527,10 +475,10 @@ public class SqlTypes {
|
||||||
/**
|
/**
|
||||||
* Does the given JDBC type code represent some sort of
|
* Does the given JDBC type code represent some sort of
|
||||||
* variable-length character string type?
|
* variable-length character string type?
|
||||||
* @param sqlType a JDBC type code from {@link Types}
|
* @param typeCode a JDBC type code from {@link Types}
|
||||||
*/
|
*/
|
||||||
public static boolean isVarcharType(int sqlType) {
|
public static boolean isVarcharType(int typeCode) {
|
||||||
switch (sqlType) {
|
switch (typeCode) {
|
||||||
case Types.VARCHAR:
|
case Types.VARCHAR:
|
||||||
case Types.LONGVARCHAR:
|
case Types.LONGVARCHAR:
|
||||||
case Types.NVARCHAR:
|
case Types.NVARCHAR:
|
||||||
|
@ -544,10 +492,10 @@ public class SqlTypes {
|
||||||
/**
|
/**
|
||||||
* Does the given JDBC type code represent some sort of
|
* Does the given JDBC type code represent some sort of
|
||||||
* variable-length binary string type?
|
* variable-length binary string type?
|
||||||
* @param sqlType a JDBC type code from {@link Types}
|
* @param typeCode a JDBC type code from {@link Types}
|
||||||
*/
|
*/
|
||||||
public static boolean isVarbinaryType(int sqlType) {
|
public static boolean isVarbinaryType(int typeCode) {
|
||||||
switch (sqlType) {
|
switch (typeCode) {
|
||||||
case Types.VARBINARY:
|
case Types.VARBINARY:
|
||||||
case Types.LONGVARBINARY:
|
case Types.LONGVARBINARY:
|
||||||
return true;
|
return true;
|
||||||
|
@ -568,17 +516,23 @@ public class SqlTypes {
|
||||||
case Types.LONGVARBINARY:
|
case Types.LONGVARBINARY:
|
||||||
case Types.BLOB:
|
case Types.BLOB:
|
||||||
return true;
|
return true;
|
||||||
}
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the given typecode represent one of the two SQL decimal types?
|
* Does the given typecode represent one of the two SQL decimal types?
|
||||||
* @param typeCode a JDBC type code from {@link Types}
|
* @param typeCode a JDBC type code from {@link Types}
|
||||||
*/
|
*/
|
||||||
public static boolean isNumericOrDecimal(int typeCode) {
|
public static boolean isNumericOrDecimal(int typeCode) {
|
||||||
return typeCode == NUMERIC
|
switch ( typeCode ) {
|
||||||
|| typeCode == DECIMAL;
|
case NUMERIC:
|
||||||
|
case DECIMAL:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -586,9 +540,14 @@ public class SqlTypes {
|
||||||
* @param typeCode a JDBC type code from {@link Types}
|
* @param typeCode a JDBC type code from {@link Types}
|
||||||
*/
|
*/
|
||||||
public static boolean isFloatOrRealOrDouble(int typeCode) {
|
public static boolean isFloatOrRealOrDouble(int typeCode) {
|
||||||
return typeCode == FLOAT
|
switch ( typeCode ) {
|
||||||
|| typeCode == REAL
|
case FLOAT:
|
||||||
|| typeCode == DOUBLE;
|
case REAL:
|
||||||
|
case DOUBLE:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -596,10 +555,15 @@ public class SqlTypes {
|
||||||
* @param typeCode a JDBC type code from {@link Types}
|
* @param typeCode a JDBC type code from {@link Types}
|
||||||
*/
|
*/
|
||||||
public static boolean isIntegral(int typeCode) {
|
public static boolean isIntegral(int typeCode) {
|
||||||
return typeCode == INTEGER
|
switch ( typeCode ) {
|
||||||
|| typeCode == BIGINT
|
case INTEGER:
|
||||||
|| typeCode == SMALLINT
|
case BIGINT:
|
||||||
|| typeCode == TINYINT;
|
case SMALLINT:
|
||||||
|
case TINYINT:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -607,11 +571,16 @@ public class SqlTypes {
|
||||||
* @param typeCode a JDBC type code from {@link Types}
|
* @param typeCode a JDBC type code from {@link Types}
|
||||||
*/
|
*/
|
||||||
public static boolean isTemporalType(int typeCode) {
|
public static boolean isTemporalType(int typeCode) {
|
||||||
return typeCode == DATE
|
switch ( typeCode ) {
|
||||||
|| typeCode == TIME
|
case DATE:
|
||||||
|| typeCode == TIMESTAMP
|
case TIME:
|
||||||
|| typeCode == TIMESTAMP_WITH_TIMEZONE
|
case TIMESTAMP:
|
||||||
|| typeCode == TIMESTAMP_UTC;
|
case TIMESTAMP_WITH_TIMEZONE:
|
||||||
|
case TIMESTAMP_UTC:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -626,10 +595,15 @@ public class SqlTypes {
|
||||||
* @param typeCode a JDBC type code from {@link Types}
|
* @param typeCode a JDBC type code from {@link Types}
|
||||||
*/
|
*/
|
||||||
public static boolean hasDatePart(int typeCode) {
|
public static boolean hasDatePart(int typeCode) {
|
||||||
return typeCode == DATE
|
switch ( typeCode ) {
|
||||||
|| typeCode == TIMESTAMP
|
case DATE:
|
||||||
|| typeCode == TIMESTAMP_WITH_TIMEZONE
|
case TIMESTAMP:
|
||||||
|| typeCode == TIMESTAMP_UTC;
|
case TIMESTAMP_WITH_TIMEZONE:
|
||||||
|
case TIMESTAMP_UTC:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -637,9 +611,14 @@ public class SqlTypes {
|
||||||
* @param typeCode a JDBC type code from {@link Types}
|
* @param typeCode a JDBC type code from {@link Types}
|
||||||
*/
|
*/
|
||||||
public static boolean hasTimePart(int typeCode) {
|
public static boolean hasTimePart(int typeCode) {
|
||||||
return typeCode == TIME
|
switch ( typeCode ) {
|
||||||
|| typeCode == TIMESTAMP
|
case TIME:
|
||||||
|| typeCode == TIMESTAMP_WITH_TIMEZONE
|
case TIMESTAMP:
|
||||||
|| typeCode == TIMESTAMP_UTC;
|
case TIMESTAMP_WITH_TIMEZONE:
|
||||||
|
case TIMESTAMP_UTC:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,10 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.type.descriptor.jdbc;
|
package org.hibernate.type.descriptor.jdbc;
|
||||||
|
|
||||||
import java.sql.Types;
|
|
||||||
import jakarta.persistence.EnumType;
|
import jakarta.persistence.EnumType;
|
||||||
import jakarta.persistence.TemporalType;
|
import jakarta.persistence.TemporalType;
|
||||||
|
|
||||||
import org.hibernate.TimeZoneStorageStrategy;
|
import org.hibernate.TimeZoneStorageStrategy;
|
||||||
import org.hibernate.type.SqlTypes;
|
|
||||||
import org.hibernate.type.descriptor.java.BasicJavaType;
|
import org.hibernate.type.descriptor.java.BasicJavaType;
|
||||||
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
|
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
|
||||||
import org.hibernate.type.spi.TypeConfiguration;
|
import org.hibernate.type.spi.TypeConfiguration;
|
||||||
|
|
|
@ -19,7 +19,8 @@ import org.hibernate.type.spi.TypeConfiguration;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basically a map from JDBC type code (int) -> {@link JdbcType}
|
* A registry mapping {@link org.hibernate.type.SqlTypes JDBC type codes}
|
||||||
|
* to implementations of the {@link JdbcType} interface.
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
* @author Andrea Boriero
|
* @author Andrea Boriero
|
||||||
|
|
Loading…
Reference in New Issue