Is it possible to apply @Min constraint to a float type?
For example:
@Entity
public class Stock
{
@Id
@GeneratedValue
private Long id;
@NotNull
@Min(0.1)
private float count;
}
Long type is required in @Min annotation so is there any other way how to achieve the same?
@DecimalMax
The value of the field or property must be a decimal value lower than or equal to the number in the value element.
@DecimalMax("30.00")
BigDecimal discount;
@DecimalMin
The value of the field or property must be a decimal value greater than or equal to the number in the value element.
@DecimalMin("5.00")
BigDecimal discount;
@Digits
The value of the field or property must be a number within a specified range. The integer element specifies the maximum integral digits for the number, and the fraction element specifies the maximum fractional digits for the number.
@Digits(integer=6, fraction=2)
BigDecimal
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With