The property type of the Java entity class corresponds to the table __c# of the Database table field type

Source: Internet
Author: User
Tags locale

There are many different types of data in Java and data types in SQL, which need to be carefully differentiated, otherwise it is easy to create inexplicable errors in development.

Java Data types

Hibernate data type

Standard SQL data type
(PS: May vary for different db)

BYTE, Java.lang.Byte

Byte

TINYINT

Short, Java.lang.Short

Short

SMALLINT

int, Java.lang.Integer

Integer

Ingeger

Long, Java.lang.Long

Long

BIGINT

float, java.lang.Float

Float

FLOAT

Double, java.lang.Double

Double

DOUBLE

Java.math.BigDecimal

Big_decimal

NUMERIC

Char, Java.lang.Character

Character

CHAR (1)

Boolean, Java.lang.Boolean

Boolean

BIT

Java.lang.String

String

VARCHAR

Boolean, Java.lang.Boolean

Yes_no

CHAR (1) (' Y ' or ' N ')

Boolean, Java.lang.Boolean

True_false

CHAR (1) (' Y ' or ' N ')

Java.util.Date, Java.sql.Date

Date

DATE

Java.util.Date, Java.sql.Time

Time

Time

Java.util.Date, Java.sql.Timestamp

Timestamp

TIMESTAMP

Java.util.Calendar

Calendar

TIMESTAMP

Java.util.Calendar

Calendar_date

DATE

Byte[]

Binary

VARBINARY, BLOB

Java.lang.String

Text

Clob

Java.io.Serializable

Serializable

VARBINARY, BLOB

Java.sql.Clob

Clob

Clob

Java.sql.Blob

Blob

Blob

Java.lang.Class

Class

VARCHAR

Java.util.Locale

Locale

VARCHAR

Java.util.TimeZone

TimeZone

VARCHAR

Java.util.Currency

Currency

VARCHAR

Turn from: https://blog.csdn.net/lyhjava/article/details/50562786?locationNum=15

Related Article

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.