So far, this is the only official document of a transient property.
Grails Docs Transients
But, I found this interesting nugget:
Question about transient properties
"As of 2.0 if there is only a getter or only a setter method, you don't
need to declare the property name of the method in the transients list.
Only typed fields and get/set pairs that form a property but shouldn't
be persisted need to go in the transients list."
I created domain classes based on this nugget, and it does work.
My domain class just has two methods:
def getPercentMinutes(){ "transient PercentMinutes" } def getPercentCost(){ "transient PercentCost" }And does not have a "transients" property.
static transients = ['']It doesn't need it. Finally, no columns for these properties are created in the DB.
Be careful, do not use a closure as your method call. E.g., don't do this:
def getPercentMinutes = { "transient PercentMinutes" } def getPercentCost = { "transient PercentCost" }
1 comments:
Thanks for writing this up. We started noticing that (accidentally) omitting new computed properties from transients was no longer causing errors on persistence and were wondering what was going on.
Reported an issue against the documentation:
http://jira.grails.org/browse/GRAILS-11016
Post a Comment