Grails: Property Null error

Posted by richardhell on Stack Overflow See other posts from Stack Overflow or by richardhell
Published on 2011-03-17T20:20:31Z Indexed on 2011/03/19 0:09 UTC
Read the original article Hit count: 254

I've a domain called Modulo with some properties and a Controller with a method that create a object from model and save it, when execute save the shell show this error:

  • La propiedad [{0}] de la clase [{1}] no puede ser nulo

But if i set the constraint nullable to true, the error show again. I think that i should not set this cosntraint.

The model is linked to a mysql table with all properties except id allow null.

I think I am not doing something wrong here. Any advice??

Domain: Modulo

class Modulo {
    String nombre
    String icon
    String url




//static constraint = {
  //    url(nullable:true)
  //}

  }

Controller: Example

class ExampleController {
    def index = { 
       def modulo = new Modulo(
         nombre:'xxx',
         icon:'xxx'
        )

        if (modulo.save()){
          println 'ok'
        }else{
          modulo.errors.allErrors.each { println it.defaultMessage}
        }
    }
}

Thanks. José

© Stack Overflow or respective owner

Related posts about grails

Related posts about grails-domain-class