标签: java postgresql hibernate jpa
我在PostgreSQL中有一个表,其中包含类型为numeric(20)的列。
numeric(20)
我已将此列映射到Long类型的字段。
Long
虽然验证部分hibernate给了我一个例外,说:Found: numeric, expected: int8。我无法更改数据库中的列类型,如何解决?
Found: numeric, expected: int8
答案 0 :(得分:4)
只需将columnDefinition添加到列注释中:
columnDefinition
@Column(name = "id", columnDefinition = "NUMERIC", length = 20)