Grails GORM using immutable embedded object

Viewed 575

I have a GORM class which is using an embedded instance in it. And the embedded instance is an immutable class. When I try to start the app, it is throwing the setter property is not found exception.

Caused by: org.hibernate.PropertyNotFoundException: Could not find a setter for property amount in class com.xxx.Money.

This is my GORM class:

class Billing {
    static embedded = ['amount']
    Money amount
}

And Money is defined as immutable:

final class Money {
    final Currency currency
    final BigDecimal value

    Money(Currency currency, BigDecimal value) {
        this.currency = currency
        this.value = value
    }
}

Anyway to resolve this without making Money mutable?

Thanks!

1 Answers
Related