How do I use the @Size
annotation for MySQL DECIMAL(x,y)
columns?
I'm using BigDecimal
, but when I try to include the @Size
max
it doesn't work. Here is my code:
@Size(max = 7,2)
@Column(name = "weight")
private BigDecimal weight;
You could use the Hibernate Validator directly, and annotate your field with @Digits like so:
@Digits(integer=5, fraction=2)
@Column(name = "weight")
private BigDecimal weight;