Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Hibernate注释将Firebird Smallint映射为布尔值?_Hibernate_Firebird_Hibernate Annotations - Fatal编程技术网

如何使用Hibernate注释将Firebird 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

我有一个在Firebird 2.0中运行的旧数据库,我需要将SmallInt列映射为布尔类型,当
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;
现在这就像一个符咒