【发布时间】:2011-12-23 17:56:37
【问题描述】:
我在 MySQL 表 (TINYINT(1)) 中有一个 BOOLEAN 类型,我正在尝试将布尔字段映射到实体中,但这会产生异常:
org.hibernate.HibernateException: Wrong column type in maegul.users for column admin. Found: bit, expected: boolean
我将实体中的字段更改为字节并进行相应的更改,使其成为布尔值,我得到:
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
【问题讨论】:
-
可能是一些有用的信息here。
-
@alvinbaena:下面有正确答案吗??
-
我认为这是一个重复的问题,已在此处回答:stackoverflow.com/questions/3383169/…
标签: java mysql hibernate types