mysql中没有boolean,而是tinyint

MySQL保存boolean值时用1代表TRUE,0代表FALSE。boolean在MySQL里的类型为tinyint(1)。MySQL里有四个常量:true,false,TRUE,FALSE分别代表1,0,1,0。

create table test

(
   id int primary key,
   bl boolean

)

这样是可以创建成功。查看建表后的语句会发现,mysql把它替换成tinyint(1)。

在pojo里直接定义该属性为布尔值即可:private Boolean status

猜你喜欢

转载自blog.csdn.net/ale1129809478/article/details/80854362