0

我在 ORACLE 10g 数据库中有一个表,其中有一列“ kzCode NUMBER(1)”。

如果我尝试将其与 JBOSS Server WebApp 中的 Hibernate 注释映射,如下所示:

@Column(nullable=false)
private Integer kzCode;

我收到一个错误:

org.hibernate.HibernateException: Wrong column type: kzCode, expected: integer

我也试过

@Column(nullable=false) private BigInteger kzCode;

错误:

org.hibernate.HibernateException: Wrong column type: kzCode, expected:numeric(19,2)

我真的不知道,要采用什么 Java 类型。

4

2 回答 2

1

ok, got it!

I had a wrong dialect property in persistence.xml file. Now all works fine..

于 2008-12-05T14:19:03.933 回答
0
@Column(nullable=false)
private Boolean kzCode;

or if you really want it to be a number, change the Oracle type to NUMBER(36, 0) and use long or Long in your Java.

于 2008-12-05T14:03:17.180 回答