如何使用Hibernate注释将Firebird Smallint映射为布尔值?
我有一个在Firebird 2.0中运行的旧数据库,我需要将SmallInt列映射为布尔类型,当如何使用Hibernate注释将Firebird Smallint映射为布尔值?,hibernate,firebird,hibernate-annotations,Hibernate,Firebird,Hibernate Annotations,我有一个在Firebird 2.0中运行的旧数据库,我需要将SmallInt列映射为布尔类型,当SmallInt=0时,它是False,当SmallInt=1时,它是True 我还需要使用Hibernate注释来完成这项工作 我正在使用Hibernate3.6 有什么建议吗 提前谢谢。再搜索一点,我可以在上找到这个hibernate类型org.hibernate.type.NumericBooleanType 我试着以这种方式绘制地图: @Type(type = "org.hibernate.t
SmallInt=0
时,它是False
,当SmallInt=1
时,它是True
我还需要使用Hibernate注释来完成这项工作
我正在使用Hibernate3.6
有什么建议吗
提前谢谢。再搜索一点,我可以在上找到这个hibernate类型
org.hibernate.type.NumericBooleanType
我试着以这种方式绘制地图:
@Type(type = "org.hibernate.type.NumericBooleanType")
private Boolean field;
@Column(columnDefinition = "SMALLINT")
@Type(type = "org.hibernate.type.NumericBooleanType")
private Boolean field;
但是,这不起作用,因为Hibernate抛出了以下异常:
org.hibernate.HibernateException: Wrong column type in %TABLE_NAME% for column %COLUMN_NAME%. Found: smallint, expected: integer
因此,我试图强制定义此列,以这种方式映射:
@Type(type = "org.hibernate.type.NumericBooleanType")
private Boolean field;
@Column(columnDefinition = "SMALLINT")
@Type(type = "org.hibernate.type.NumericBooleanType")
private Boolean field;
现在这就像一个符咒