我有一个读取和写入表的代码,该表的字段为位(1)。当我阅读此表时,hibernate 会将其转换为 boolean
就好,但是当我尝试保存到它时,它给我 column is type bit but expression is type boolean
。我无法将此字段更改为 boolean 值
。
到目前为止,我尝试将 @Type
查看到 hibernate 的 BooleanType
但没有成功。
最佳答案
bit [ (n) ] fixed-length bit string
虽然在某些数据库(MySQL 和其他一些数据库)中,bit(1)
是一个 boolean 值
,但在 Postgres 中 it's not 。 Postgres 具有应该使用的 boolean
数据类型。
关于java - 如何在 bit(1) 字段中保存 boolean 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58522349/