org.hibernate.type.StandardBasicTypes.java Source code

Java tutorial

Introduction

Here is the source code for org.hibernate.type.StandardBasicTypes.java

Source

/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
 * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
 */
package org.hibernate.type;

import java.util.HashSet;
import java.util.Set;

import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;

/**
 * Centralizes access to the standard set of basic {@link Type types}.
 * <p/>
 * Type mappings can be adjusted per {@link org.hibernate.SessionFactory}.  These adjusted mappings can be accessed
 * from the {@link org.hibernate.TypeHelper} instance obtained via {@link org.hibernate.SessionFactory#getTypeHelper()}
 *
 * @see BasicTypeRegistry
 * @see org.hibernate.TypeHelper
 * @see org.hibernate.SessionFactory#getTypeHelper()
 *
 * @author Gavin King
 * @author Steve Ebersole
 */
@SuppressWarnings({ "UnusedDeclaration" })
public final class StandardBasicTypes {
    private StandardBasicTypes() {
    }

    private static final Set<SqlTypeDescriptor> SQL_TYPE_DESCRIPTORS = new HashSet<SqlTypeDescriptor>();

    /**
     * The standard Hibernate type for mapping {@link Boolean} to JDBC {@link java.sql.Types#BIT BIT}.
     *
     * @see BooleanType
     */
    public static final BooleanType BOOLEAN = BooleanType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link Boolean} to JDBC {@link java.sql.Types#INTEGER INTEGER}.
     *
     * @see NumericBooleanType
     */
    public static final NumericBooleanType NUMERIC_BOOLEAN = NumericBooleanType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link Boolean} to JDBC {@link java.sql.Types#CHAR CHAR(1)} (using 'T'/'F').
     *
     * @see TrueFalseType
     */
    public static final TrueFalseType TRUE_FALSE = TrueFalseType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link Boolean} to JDBC {@link java.sql.Types#CHAR CHAR(1)} (using 'Y'/'N').
     *
     * @see YesNoType
     */
    public static final YesNoType YES_NO = YesNoType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link Byte} to JDBC {@link java.sql.Types#TINYINT TINYINT}.
     */
    public static final ByteType BYTE = ByteType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link Short} to JDBC {@link java.sql.Types#SMALLINT SMALLINT}.
     *
     * @see ShortType
     */
    public static final ShortType SHORT = ShortType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link Integer} to JDBC {@link java.sql.Types#INTEGER INTEGER}.
     *
     * @see IntegerType
     */
    public static final IntegerType INTEGER = IntegerType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link Long} to JDBC {@link java.sql.Types#BIGINT BIGINT}.
     *
     * @see LongType
     */
    public static final LongType LONG = LongType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link Float} to JDBC {@link java.sql.Types#FLOAT FLOAT}.
     *
     * @see FloatType
     */
    public static final FloatType FLOAT = FloatType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link Double} to JDBC {@link java.sql.Types#DOUBLE DOUBLE}.
     *
     * @see DoubleType
     */
    public static final DoubleType DOUBLE = DoubleType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link java.math.BigInteger} to JDBC {@link java.sql.Types#NUMERIC NUMERIC}.
     *
     * @see BigIntegerType
     */
    public static final BigIntegerType BIG_INTEGER = BigIntegerType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link java.math.BigDecimal} to JDBC {@link java.sql.Types#NUMERIC NUMERIC}.
     *
     * @see BigDecimalType
     */
    public static final BigDecimalType BIG_DECIMAL = BigDecimalType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link Character} to JDBC {@link java.sql.Types#CHAR CHAR(1)}.
     *
     * @see CharacterType
     */
    public static final CharacterType CHARACTER = CharacterType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link String} to JDBC {@link java.sql.Types#VARCHAR VARCHAR}.
     *
     * @see StringType
     */
    public static final StringType STRING = StringType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link String} to JDBC {@link java.sql.Types#NVARCHAR NVARCHAR}
     */
    public static final StringNVarcharType NSTRING = StringNVarcharType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link java.net.URL} to JDBC {@link java.sql.Types#VARCHAR VARCHAR}.
     *
     * @see UrlType
     */
    public static final UrlType URL = UrlType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link java.util.Date} ({@link java.sql.Time}) to JDBC
     * {@link java.sql.Types#TIME TIME}.
     *
     * @see TimeType
     */
    public static final TimeType TIME = TimeType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link java.util.Date} ({@link java.sql.Date}) to JDBC
     * {@link java.sql.Types#DATE DATE}.
     *
     * @see TimeType
     */
    public static final DateType DATE = DateType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link java.util.Date} ({@link java.sql.Timestamp}) to JDBC
     * {@link java.sql.Types#TIMESTAMP TIMESTAMP}.
     *
     * @see TimeType
     */
    public static final TimestampType TIMESTAMP = TimestampType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link java.util.Calendar} to JDBC
     * {@link java.sql.Types#TIMESTAMP TIMESTAMP}.
     *
     * @see CalendarType
     */
    public static final CalendarType CALENDAR = CalendarType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link java.util.Calendar} to JDBC
     * {@link java.sql.Types#DATE DATE}.
     *
     * @see CalendarDateType
     */
    public static final CalendarDateType CALENDAR_DATE = CalendarDateType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link Class} to JDBC {@link java.sql.Types#VARCHAR VARCHAR}.
     *
     * @see ClassType
     */
    public static final ClassType CLASS = ClassType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link java.util.Locale} to JDBC {@link java.sql.Types#VARCHAR VARCHAR}.
     *
     * @see LocaleType
     */
    public static final LocaleType LOCALE = LocaleType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link java.util.Currency} to JDBC {@link java.sql.Types#VARCHAR VARCHAR}.
     *
     * @see CurrencyType
     */
    public static final CurrencyType CURRENCY = CurrencyType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link java.util.TimeZone} to JDBC {@link java.sql.Types#VARCHAR VARCHAR}.
     *
     * @see TimeZoneType
     */
    public static final TimeZoneType TIMEZONE = TimeZoneType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link java.util.UUID} to JDBC {@link java.sql.Types#BINARY BINARY}.
     *
     * @see UUIDBinaryType
     */
    public static final UUIDBinaryType UUID_BINARY = UUIDBinaryType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link java.util.UUID} to JDBC {@link java.sql.Types#CHAR CHAR}.
     *
     * @see UUIDCharType
     */
    public static final UUIDCharType UUID_CHAR = UUIDCharType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@code byte[]} to JDBC {@link java.sql.Types#VARBINARY VARBINARY}.
     *
     * @see BinaryType
     */
    public static final BinaryType BINARY = BinaryType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link Byte Byte[]} to JDBC {@link java.sql.Types#VARBINARY VARBINARY}.
     *
     * @see WrapperBinaryType
     */
    public static final WrapperBinaryType WRAPPER_BINARY = WrapperBinaryType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@code byte[]} to JDBC {@link java.sql.Types#VARBINARY VARBINARY},
     * specifically for entity versions/timestamps.
     *
     * @see RowVersionType
     */
    public static final RowVersionType ROW_VERSION = RowVersionType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@code byte[]} to JDBC {@link java.sql.Types#LONGVARBINARY LONGVARBINARY}.
     *
     * @see ImageType
     * @see #MATERIALIZED_BLOB
     */
    public static final ImageType IMAGE = ImageType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link java.sql.Blob} to JDBC {@link java.sql.Types#BLOB BLOB}.
     *
     * @see BlobType
     * @see #MATERIALIZED_BLOB
     */
    public static final BlobType BLOB = BlobType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@code byte[]} to JDBC {@link java.sql.Types#BLOB BLOB}.
     *
     * @see MaterializedBlobType
     * @see #MATERIALIZED_BLOB
     * @see #IMAGE
     */
    public static final MaterializedBlobType MATERIALIZED_BLOB = MaterializedBlobType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@code char[]} to JDBC {@link java.sql.Types#VARCHAR VARCHAR}.
     *
     * @see CharArrayType
     */
    public static final CharArrayType CHAR_ARRAY = CharArrayType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link Character Character[]} to JDBC
     * {@link java.sql.Types#VARCHAR VARCHAR}.
     *
     * @see CharacterArrayType
     */
    public static final CharacterArrayType CHARACTER_ARRAY = CharacterArrayType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link String} to JDBC {@link java.sql.Types#LONGVARCHAR LONGVARCHAR}.
     * <p/>
     * Similar to a {@link #MATERIALIZED_CLOB}
     *
     * @see TextType
     */
    public static final TextType TEXT = TextType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link String} to JDBC {@link java.sql.Types#LONGNVARCHAR LONGNVARCHAR}.
     * <p/>
     * Similar to a {@link #MATERIALIZED_NCLOB}
     *
     * @see NTextType
     */
    public static final NTextType NTEXT = NTextType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link java.sql.Clob} to JDBC {@link java.sql.Types#CLOB CLOB}.
     *
     * @see ClobType
     * @see #MATERIALIZED_CLOB
     */
    public static final ClobType CLOB = ClobType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link java.sql.NClob} to JDBC {@link java.sql.Types#NCLOB NCLOB}.
     *
     * @see NClobType
     * @see #MATERIALIZED_NCLOB
     */
    public static final NClobType NCLOB = NClobType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link String} to JDBC {@link java.sql.Types#CLOB CLOB}.
     *
     * @see MaterializedClobType
     * @see #MATERIALIZED_CLOB
     * @see #TEXT
     */
    public static final MaterializedClobType MATERIALIZED_CLOB = MaterializedClobType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link String} to JDBC {@link java.sql.Types#NCLOB NCLOB}.
     *
     * @see MaterializedNClobType
     * @see #MATERIALIZED_CLOB
     * @see #NTEXT
     */
    public static final MaterializedNClobType MATERIALIZED_NCLOB = MaterializedNClobType.INSTANCE;

    /**
     * The standard Hibernate type for mapping {@link java.io.Serializable} to JDBC {@link java.sql.Types#VARBINARY VARBINARY}.
     * <p/>
     * See especially the discussion wrt {@link ClassLoader} determination on {@link SerializableType}
     *
     * @see SerializableType
     */
    public static final SerializableType SERIALIZABLE = SerializableType.INSTANCE;
}