3.Hibernate Mapping Type

Source: Internet
Author: User

Mapping Type

When you prepare a Hibernate mapping file, we have seen you map the Java data type to the RDBMS data format. The types that have been declared to be used in the mapping file are not Java data types, nor are they SQL database types. This type is known as the Hibernate mapping type, which can be translated from Java to SQL and vice versa.

In this chapter, all the bases, dates and times, large data objects, and other embedded mapping data types are listed.

Original Type
Mapping Type Java Type ANSI SQL Type
Integer int or Java.lang.Integer INTEGER
Long Long or Java.lang.Long BIGINT
Short Short or Java.lang.Short SMALLINT
Float float or java.lang.Float FLOAT
Double Double or java.lang.Double DOUBLE
Big_decimal Java.math.BigDecimal NUMERIC
Character Java.lang.String CHAR (1)
String Java.lang.String VARCHAR
Byte byte or Java.lang.Byte TINYINT
Boolean Boolean or Java.lang.Boolean BIT
Yes/no Boolean or Java.lang.Boolean CHAR (1) (' Y ' or ' N ')
True/false Boolean or Java.lang.Boolean CHAR (1) (' T ' or ' F ')
date and Time type
Mapping Type Java Type ANSI SQL Type
Date Java.util.Date or Java.sql.Date DATE
Time Java.util.Date or Java.sql.Time Time
Timestamp Java.util.Date or Java.sql.Timestamp TIMESTAMP
Calendar Java.util.Calendar TIMESTAMP
Calendar_date Java.util.Calendar DATE
Binary and large data Objects
Mapping Type Java Type ANSI SQL Type
Binary Byte[] VARBINARY (or BLOB)
Text Java.lang.String Clob
Serializable Any Java class that implements Java.io.Serializable VARBINARY (or BLOB)
Clob Java.sql.Clob Clob
Blob Java.sql.Blob Blob
JDK-related types
mapping type java type ansi SQL type
Class Java.lang.Class VARCHAR
Locale Java.util.Locale VARCHAR
TimeZone Java.util.TimeZone VARCHAR
Currency Java.util.Currency VARCHAR

_______________________________________________________________________________________________________________ __________

3.Hibernate Mapping Type

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.