H2数据的字段类型与Java类型映射对应关系

205 篇文章 0 订阅
127 篇文章 1 订阅

INT | INTEGER | MEDIUMINT | INT4 | SIGNED
java.lang.Integer.

BOOLEAN | BIT | BOOL
java.lang.Boolean.

TINYINT
Possible values are: -128 to 127.

Mapped to java.lang.Byte.

SMALLINT | INT2 | YEAR
Possible values: -32768 to 32767.

Mapped to java.lang.Short.

BIGINT | INT8
Possible values: -9223372036854775808 to 9223372036854775807.

Mapped to java.lang.Long.
IDENTITY
Auto-Increment value. Possible values: -9223372036854775808 to 9223372036854775807. 

Mapped to java.lang.Long.

{ DECIMAL | NUMBER | DEC | NUMERIC } ( precisionInt [ , scaleInt ] )
Data type with fixed precision and scale. This data type is recommended for storing currency values.

Mapped to java.math.BigDecimal.

{ DOUBLE [ PRECISION ] | FLOAT [ ( precisionInt ) ] | FLOAT8 }
A floating point number. Should not be used to represent currency values, because of rounding problems. If precision value is specified for FLOAT type name, it should be from 25 to 53.

Mapped to java.lang.Double.

{ REAL | FLOAT ( precisionInt ) | FLOAT4 }
A single precision floating point number. Should not be used to represent currency values, because of rounding problems. Precision value for FLOAT type name should be from 0 to 24.

Mapped to java.lang.Float.


TIME
TIME [ ( precisionInt ) ] [ WITHOUT TIME ZONE ]
The time data type. The format is hh:mm:ss[.nnnnnnnnn]. If fractional seconds precision is specified it should be from 0 to 9, 0 is default.

Mapped to java.sql.Time. When converted to a java.sql.Date, the date is set to 1970-01-01. java.time.LocalTime is also supported on Java 8 and later versions.

{ BINARY | VARBINARY | BINARY VARYING
| LONGVARBINARY | RAW | BYTEA }
[ ( precisionInt ) ]

Mapped to byte[].

OTHER
Mapped to java.lang.Object (or any subclass).

{ VARCHAR | CHARACTER VARYING | LONGVARCHAR | VARCHAR2 | NVARCHAR
| NVARCHAR2 | VARCHAR_CASESENSITIVE} [ ( precisionInt ) ]

VARCHAR_IGNORECASE [ ( precisionInt ) ]
{ CHAR | CHARACTER | NCHAR } [ ( precisionInt ) ]
Mapped to java.lang.String.


{ BLOB | BINARY LARGE OBJECT
| TINYBLOB | MEDIUMBLOB | LONGBLOB | IMAGE | OID }
[ ( precisionInt [K|M|G|T|P]) ]
Mapped to java.sql.Blob (java.io.InputStream is also supported).

{ CLOB | CHARACTER LARGE OBJECT
| TINYTEXT | TEXT | MEDIUMTEXT | LONGTEXT | NTEXT | NCLOB }
[ ( precisionInt [K|M|G|T|P] [CHARACTERS|OCTETS]) ]
Mapped to java.sql.Clob (java.io.Reader is also supported).

ARRAY
An array of values. Mapped to java.lang.Object[]

{ ENUM (string [, ... ]) }
A type with enumerated values. Mapped to java.lang.Integer.


GEOMETRY
[({ GEOMETRY |
{ POINT
| LINESTRING
| POLYGON
| MULTIPOINT
| MULTILINESTRING
| MULTIPOLYGON
| GEOMETRYCOLLECTION } [Z|M|ZM]}
[, sridInt] )]
Mapped to org.locationtech.jts.geom.Geometry if JTS library is in classpath and to java.lang.String otherwise.


INTERVAL
intervalYearType | intervalMonthType | intervalDayType
| intervalHourType| intervalMinuteType | intervalSecondType
| intervalYearToMonthType | intervalDayToHourType
| intervalDayToMinuteType | intervalDayToSecondType
| intervalHourToMinuteType | intervalHourToSecondType
| intervalMinuteToSecondType


Mapped to org.h2.api.Interval.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值