////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////


== transients



=== Purpose


Defines a list of property names that should not be persisted to the database. This is often useful if you have read-only accessor methods ("getters") that are helper methods but get confused as being persistence-related.


=== Examples


[source,groovy]
----
class Author {
   String name
   String getUpperCaseName() { name.toUpperCase() }

   static transients = ['upperCaseName']
}
----

Here we have an accessor that takes the `name` and converts it to uppercase. It doesn't make sense to persist this derived value, so we mark it as transient adding its JavaBean property name to the `transients` list.

NOTE: As of Grails 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.
