Hibernate:列类型错误:accountBalance,expected:numeric(19,2)?

时间:2015-12-02 13:50:31

标签: java sql-server hibernate sql-server-2008

我收到以下错误。

  

列类型错误:accountBalance,expected:numeric(19,2)。

我尝试添加columnDefinition="smallmoney"

但没有工作。

我可以将其更改为整数但阅读此映射后我有点谨慎.. http://jtds.sourceforge.net/typemap.html

任何想法该做什么..我在后端使用MSSQL服务器..

现在将其改为Integer

  

错误的列类型:accountBalance,expected:int

我当前的注释定义是这样的。

@Column(name = "AccountBalance",columnDefinition="smallmoney", nullable = false, precision = 10)
 private BigDecimal accountBalance;

1 个答案:

答案 0 :(得分:0)

我所做的是正确的,因为我保留了

,我收到了这个错误
hibernate.hbm2ddl.auto = validate //validate the schema, makes no changes to the database.

将此值更改为

hibernate.hbm2ddl.auto = update  // update the schema.

一切正常..

但不确定实际原因......