small medium large xlarge

Back to: All Forums  Grails
Generic-user-small
20 Nov 2009, 17:10
Bharat Ruparel (148 posts)

It seems like either I have managed to disable the constraints on domain classes or Grails 1.2 M4 is not working correctly. But I can pretty much create a blank record for any kind of domain classes, e.g., TekEvent, TekUser etc. Does anyone know what could be wrong? Bharat

Dklein_tiny_pragsmall
21 Nov 2009, 20:09
Dave Klein (34 posts)

I haven’t tried starting from scratch with Grails 1.2 yet, but will shortly.

One thought comes to mind though. Grails will not change the constraints on an existing table/column if there is a chance that it could cause data loss or leave data in an invalid state. So, for example, if you create a domain class with nullalbe:true and then later change it to nullable:false, it won’t make that change unless you drop and recreate the corresponding table. Not sayin that this is the situation you are in, but it might give you some ideas of things to look at.

Are you using a database (MySQL, PostgreSQL, etc.) or the in-memory HSQL DB?

Thanks, Dave

Generic-user-small
22 Nov 2009, 02:09
Bharat Ruparel (148 posts)

“So, for example, if you create a domain class with nullalbe:true and then later change it to nullable:false, it won’t make that change unless you drop and recreate the corresponding table.”

That was the problem. Thanks. I am using MySQL.

Bharat

Generic-user-small
11 Jan 2010, 07:24
Ray Tayek (10 posts)

using 1.2, i was able to create tek events with a blank name or city. explicitly adding (nullable:false,blank:false) fixed this.

thanks

You must be logged in to comment