Is there a way of telling GORM not to persist a property? I'm planning to define a confirm password property on my User class that I'll use for validation, but shouldn't be persisted.
Thanks.
Is there a way of telling GORM not to persist a property? I'm planning to define a confirm password property on my User class that I'll use for validation, but shouldn't be persisted.
Thanks.
OK - just managed to answer my own question with some more searching. Should have been more patient.
A static transients
property "defines a list of property names that should not be persisted to the database. This is often useful if you have read-only getters that include logic."
http://grails.org/doc/latest/ref/Domain%20Classes/transients.html
Using transient key word GORM can be directed not to persist specific property.
Following code snippets shows the use of transient proerties
class Book {
static transients = [ "digitalCopy" ]
static constraints = {
releaseDate(nullable: true)
} String author
String title
Date releaseDate
File digitalCopy
}
digitalCopy property included in transient declaration notifies GORM not to persist digitalCopy