繁体   English   中英

如何在MySQL中使用mybatis更新位类型的表值字段?

[英]How to update the table value field which type is bit using mybatis in mysql?

我有一个名为tbStudent的表。 当我使用整数设置性别字段,并将参数值传递为1或0时,它工作得很好。 但是现在,当我尝试使用位更新性别字段类型,并将参数值传递为1或0时,它无法正常工作。 我尝试将参数值传递为true或false,但仍无法按预期方式工作。 如何修复它,使其可以与钻头一起使用? 错误是:

//I only pass in the value 1, why does it say too long?
Data truncation: Data too long for column 'SEX' at row 1;
nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: 
Data too long for column 'SEX' at row 1

尝试将其插入为b'1'或b'0'源: http ://dev.mysql.com/doc/refman/5.0/en/bit-field-literals.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM