I have been using the Joda-Time plugin for Grails. I'm really starting to love it but, I'm trying to set a default value for domain attribute (Period type:PersistentPeriod). Everything is working great. I can save and retrieve Joda-Time data, the tag library is working well, calculations and conversions are flawless but, everything blows up when I try to compile after setting a default value for a Joda-Time attributes. Example:
class Person {
DateTime date
Period totalTime
static mapping = {
totalTime (type: PersistentPeriod, defaultValue:Period.ZERO)
date (type: PersistentDateTime, defaultValue:DateTime.now())
}
}
Is there a way to do this with default values or should I keep the Joda-Time attributes nullable and blank.