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.
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With