Q:

How to ignore field on domain object when using GORM save method

In my application I have a User domain object that has a handful of fields in it including a password field. The password field is an encrypted String using JASYPT. For development purposes I am creating a new user on startup that is hard coded. It looks like this:
User user = new User(
    userId:"user1", userFname:"Joe", 
    userLname:"Blow", userMinit:"A",
    userEmail:"joe@blow.com", userPword:"password").save()

When the save() is called I believe that in the background the hibernate saveOrUpdate() is being called. It is comparing the new domain objects field values against already existing domain object field values to decide if the record should be inserted into the db or if it should just update an already existing record.
Since the password field is always going to be a new value because of the JASYPT encryption it is inserting a new record every time.
INSERT INTO USER VALUES(1,'joe@blow.com',
    'Joe','user1','Blow','A','','','',
    'gIkUvM9b6d5vrEhkKzqKz0U7uxqRpZFhiQrrBTDbKX0=')
INSERT INTO USER VALUES(2,'joe@blow.com',
    'Joe','user1','Blow','A','','','',
    'yap0S0mCb2CpGngcANpSWoLqlL6SozLYK4WbKYHSVEw=')

Here is the Domain class:
@Table(name="user")
class User {

    String userId
    String userFname
    String userLname
    String userMinit
    String userEmail
    String userPword
    String userMisc1 = ""
    String userMisc2 = ""
    String userMisc3 = ""

    public User(){};

    static mapping = {
        version false
        columns {
            userId      column:'user_id'
            userFname   column:'user_fname'
            userLname   column:'user_lname'
            userMinit   column:'user_minit'
            userEmail   column:'user_email'
            userPword   column:'user_pword'
            userMisc1   column:'user_misc1'
            userMisc2   column:'user_misc2'
            userMisc3   column:'user_misc3'
        }

        userPword type: GormEncryptedStringType
     }

    static constraints = {}
}

Is there a way to tell GORM to ignore the password field when saving the domain object so I don't end up with the same user over and over in the DB?
Thanks for any help.

A:

Responding to the OPs comment, you can make properties non persistent in grails by adding a transients property to the domain class:
static transients = [ "userPword", "anotherOne" ]

But as pointed out above, this wouldn't help with your problem. 
Thanks, Jim.

A:

Before saving new user, you can check if that user already exists:
User user = User.findByUserId("user1") ?: new User(userId:"user1", userFname:"Joe",
                                                userLname:"Blow", userMinit:"A", 
                                                userEmail:"joe@blow.com",
                                                userPword:"password").save(flush: true)

