Tuesday, 6 January 2015

Grails : How to set default value in domain class


// How to set default value in domain class

package com.gb.vamsi

import com.gb.vamsi.common.BaseEntity

class User extends BaseEntity{

String firstName
String lastName
Long accountId
String displayName
String jobRole
String photoUrl
Date lastLogin
boolean chatStatus

static constraints = {
photoUrl nullable:true
lastLogin nullable:true
}

static mapping = {
chatStatus defaultValue:true
}
}

// Here chatStatus by default true

No comments:

Post a Comment