关于MySQL的boolean和tinyint(1)

原文:http://blog.csdn.net/woshixuye/article/details/7089508

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

原文地址:https://www.cnblogs.com/shihaiming/p/7145240.html