Hibernate corresponds to MySQL field type

Source: Internet
Author: User

Mapping type Java type Standard SQL field 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) (' Y ' or ' N ')
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 Byte[] VARBINARY (or BLOB)
Text Java.lang.String Clob
Serializable Any instance of java.io.Serializable VARBINARY (or BLOB)
Clob Java.sql.Clob Clob
Blob Java.sql.Blob Blob
Class Java.lang.Class VARCHAR
Locale Java.util.Locale VARCHAR
TimeZone Java.util.TimeZone VARCHAR
Currency Java.util.Currency VARCHAR



Before using Oracle, regardless of the use of long,int,short,double anyway is the digital type of the Numeric,mysql data type seems to be differentiated relatively thin, the previous period of time with JEECG generated code when found always put my numeric (11) Type of field generated Ava.math.BigDecimal, each time you have to manually change the code, hehe.

Hibernate corresponds to MySQL field 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.