Grails: Transients property in Constraints.groovy -


i want replace domain class in grails hibernate class(rate). constrains hibernate class can added creating file rateconstraints.groovy in src/java, , works fine validations of hibernate class. need add transients property hibernate class using rateconstraints.groovy.

eg:

consider java class

class rate {                 long id          string code              } 

rateconstraints.groovy file in ../src/java

constraints = {      id ( nullable:true )     code( nullable: false ) } 

how can add transients property in rateconstraints.groovy file

transients = ['startdate', 'enddate'] 

got answer

rateconstraints.groovy file in ../src/java

transients = ['startdate', 'enddate']

rate.metaclass.getstartdate << {-> startdate  } rate.metaclass.setstartdate << {it -> startdate = } rate.metaclass.getenddate << {-> enddate  } rate.metaclass.setenddate << {it -> enddate = }  constraints = {      id ( nullable:true )     code( nullable: false ) } 

it works


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -