0
votes

My Grails app worked fine. If I remember corectly all I did was to change a contraint on one of my domain classes from blank: true, nullable:true to blank:false, nullable: false. And now when I try to create a new instance of that class I get following error messages:

Property [contract] of class [class com.app.Request] cannot be null
Property [description] of class [class com.app.Request] cannot be null
Property [productline] of class [class com.app.Request] cannot be null
Property [requestType] of class [class com.app.Request] cannot be null
Property [subject] of class [class com.app.Request] cannot be null

And I've provided values for all of these properties.

I'm guessing there is some conflict between gorm and database. Can someone explain to me whats going on and how to fix it.

1
Maybe it's for existing instances? I mean data in database, does it have non-null values for all of specified fields? - Igor Artamonov
@IgorArtamonov Interesting. There are null values in non null fields but I had those before and everything worked. I don't know how that could be a problem. Can you elaborate? - drago

1 Answers

3
votes

I had similar problem, had updated constraints to non-null, but my stored data had nulls for non-null fields. At some point Grails tries to load existing data, but fails on validation step.

Try to update your database with some default values (I mean by using plain SQL UPDATE SET x = 'temp' WHERE x IS NULL), make grails clean and restart your app. Should help.