I created a domain class recently:
class Foo {
...
double price
static constraints = {
price(min: 0.0)
}
}
Boom! The application failed to run with the error message:
Parameter for constraint [min] of property [value] of class [class Foo]
must be the same type as property: [double]
The cause of the problem is that I declared price to be a double, but 0.0 is a BigDecimal in Groovy. To fix the problem, change the value to 0.0d. I found the answer from this thread.
No comments:
Post a Comment