Grails: Property Null error
- by richardhell
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é