What are Transient Properties

Posted by Anantha Narayanan On 3:32 PM 2 comments


Grails GORM by default creates all the properties on your domain as columns in database tables. We may not require such functionality. For Example in a user creation domain we may require the user to enter the confirm password along with password. We will definitely not require two columns in tables with same password (provided there is validation for that).

In such cases you can map properties in domain as Transient, conveying to Grails GORM not to create a column for the property. For Example:

Class Person {
  static transients = ["confirmPassswd"]

  String firstName
  String lastName
  String emailID
  String loginPasswd
  String confirmPasswd
}

In Grails it is simple enough to define such extensible features.

2 comments:

Post a Comment

Recommended Post Slide Out For Blogger