将一个小值映射为布尔休眠
我在MySQL表中有一个布尔类型(TINYINT(1)),我正在尝试在实体中映射布尔字段,但这会产生异常:
org.hibernate.HibernateException: Wrong column type in maegul.users for column admin. Found: bit, expected: boolean
我将实体中的字段更改为byte并进行相应的更改,使其充当布尔值,我得到:
org.hibernate.HibernateException: Wrong column type in maegul.users for column admin. Found: bit, expected: tinyint
我尝试在字段上使用注释:@Type
@Type(type = "org.hibernate.type.NumericBooleanType")
但我得到:
org.hibernate.HibernateException: Wrong column type in maegul.users for column admin. Found: bit, expected: integer