首页 > 解决方案 > What Java datatype can I use for MY SQL TinyInt

问题描述

I am confused with this documentation https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-type-conversions.html

TINYINT java.lang.Boolean if the configuration property tinyInt1isBit is set to true (the default) and the storage size is 1, or java.lang.Integer if not.

I have this in entity class

@Column(columnDefinition = "TINYINT default 0")
private boolean tcheck;

I see this in DB

tcheck TINYINT default 0,

The numeric precision column is 3.

I think this means storage is 3 ?

Can I change private boolean tcheck; ===> to ===> java.lang.Integer?

I use flyway, so dont want to risk application start/corrupt db (or) updates to column width.[as size 3 is good enough]

I am assuming that changing to java.lang.Integer will not require update DB column. IS this correct?

please advice

标签: mysqlspring-data-jpa

解决方案


推荐阅读