Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8184475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:30:58+00:00 2026-06-07T01:30:58+00:00

After migrating from Grails 1.3.7 to 2.0.4 I have noticed a problem with one

  • 0

After migrating from Grails 1.3.7 to 2.0.4 I have noticed a problem with one of my domain classes where I use transient properties in order to handle passwords.

My domain class looks like this (simplified):

   package test

   class User {
String email 
String password1
String password2
//ShiroUser shiroUser

static constraints = {
    email(email:true, nullable:false, unique:true)
    password1(nullable:true,size:5..30, blank: false, validator: {password, obj ->

        if(password==null && !obj.properties['id']){
          return ['no.password']
        }
        else return true
      })
    password2(nullable:true, blank: false, validator: {password, obj ->
         def password1 = obj.properties['password1']

         if(password == null && !obj.properties['id']){
          return ['no.password']
        }
        else{
          password == password1 ? true : ['invalid.matching.passwords']
        }
      })

}
static transients = ['password1','password2']
   }

In 1.3.7 this used to work in my Bootstrap:

    def user1= new User (email: "test@test.com", password1: "123456", password2: "123456")
    user1.save()

However, in Grails 2.0.x this will result in error stating that password1 and password2 are both null.
The same thing happens in my controllers if I try to do:

    def user2= new User (params)// params include email,password1 and password2 

In order to make it work I have to do the following workaround:

    def user2= new User (params)// params include email,password1 and password2 
    user2.password1=params.password1
    user2.password2=params.password2
    user2.save()

This is quite ugly – and annoying.

Can anyone say if my usage of transients has become invalid in grails 2.x, or if this could be a framework bug of some kind?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T01:31:00+00:00Added an answer on June 7, 2026 at 1:31 am

    For security reasons transients are no longer auto-bound. But you can easily make it work by adding in a ‘bindable’ constraint (see http://grails.org/doc/latest/ref/Constraints/bindable.html). Change

    password2(nullable:true, blank: false, validator: {password, obj ->
    

    to

    password2(bindable: true, nullable:true, blank: false, validator: {password, obj ->
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After migrating magento from one to another hosting with different domain, I'm getting one
after migrating from .NET 3.5 to 4.0 i have a strange problem with a
After migrating from XCODE 4 to 4.2 i have quite a few problems with
I have a few some strange issues with my class after migrating from JDK5/Tomcat5
I have a problem migrating from Delphi 2006 to Delphi 2009. A Project which
I'm migrating an application from ColdFusion to ASP.Net MVC and have a little problem
I'm using PDO after migrating away from the mysql library. What do I use
After migrating my whole setup from Java 1.5 to 1.6 (J2EE, Tomcat) a couple
At work, we have migrated from Windows XP to Windows Vista. After the migration,
After migrating my Drupal (6.16) installation from shared hosting to Linode VPS (Ubunto 10.04

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.