【发布时间】:2015-12-02 13:50:31
【问题描述】:
我收到以下错误。
错误的列类型:accountBalance,预期为:numeric(19,2)。
我尝试添加columnDefinition="smallmoney"
但是没有用。
我可以将其更改为整数,但在阅读此映射后我有点谨慎..http://jtds.sourceforge.net/typemap.html
任何想法该怎么做..我在后端使用 MSSQL 服务器..
现在改成Integer
错误的列类型:accountBalance,预期:int
我现在的注解定义是这样的。
@Column(name = "AccountBalance",columnDefinition="smallmoney", nullable = false, precision = 10)
private BigDecimal accountBalance;
【问题讨论】:
-
数据库中的列是什么类型的?
-
smallmoney是列的数据类型 -
smallmoney 非常适合小数,但您可能会遇到问题,因为小数很容易溢出 smallmoney。我会为类使用小数,为分贝使用小数(18, 3)。
标签: java sql-server hibernate sql-server-2008