@Column(name = "price",precision = 10,scale = 2)
public double getPrice() {
return price;
}
使用 precision 与 scale 没有效果,要换成:使用columnDefinition来处理
@Column(name = "price",columnDefinition = "double(10,2) default '1.00'")
public double getPrice() {
return price;
}
对于precision和scale的用法:
-
int
-precision
- (Optional) The precision for a decimal (exact numeric) column. (Applies only if a decimal column is used.) -
int
-scale
- (Optional) The scale for a decimal (exact numeric) column. (Applies only if a decimal column is used.
这两个值只针对 BigDecimal 类型有用