My grails project doesn't define any of the classes it owns; they're all imported from another project (from hibernate reveng). The .cfg.xml and .class and .hbm.xml files are all in conf/hibernate. All the grails tools can see and manipulate them. I can connect to the DB, scaffold and generate code, and manipulate the tables.
I have put several constraints on the domains as suggested by the docs, in [myapp]/src/java/[package]/[class name]Constraints.groovy. The constraints are picked up and evaluated just fine.
However, the default messaging is not picked up by the messages in [myapp]/grails-app/i18n/messages.properties. I can delete all the default.*.message entries, and the same error messages show up through "grails clean" and "grails run-app" restarts. I can even package and deploy a WAR file and get the same messages. The unique constraint is, well, unique. There doesn't seem to be a default in place for it (even through the entry is in the messages.properties file), so it throws an exception when it's trying to print the error messages. Note that the constraints are obeyed and evaluated, it's just in the gsp at <g:renderErrors ...> that the exception is thrown.
I have created a new app and defined some grails domain classes in grails-app/domain/[stuff].groovy, and the unique constraint works fine, and changes/removal of default messaging effects the application as expected. As such, I think that this is only an issue with using existing hibernate-mapped java classes.
I noticed when trying to throw a try/catch around this as a workaround, the following:
Field error in object 'com.me.Specialization' on field 'displayName': rejected value [WIP]; codes [<trimmed for brevity>,unique]; arguments [displayName,class com.me.Specialization,WIP]; default message [null]
I can have a workaround by sticking just "unique" into the messages.properties file. It gets picked up properly. So, it's not a high priority issue, but something that will probably confuse a lot of people (I've spent about 2 days on this, until realizing this for a workaround
)