簡體   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