Grails version: 1.0.3
I have about 150 domain classes that are defined in another project, and I’m importing them into grails. I put the hibernate config in conf/hibernate/* and all the classes and .hbm files there as well. Saving, updating, etc., work fine.
To add constraints to these classes, since I am not doing them in groovy, I just stick a file in src/java/[package]/[classname]Constraints.groovy. And those get picked up just fine as well.
Now comes the bad part: when it’s done this way, it doesn’t seem grails picks up the default messages in your grails-app/i18n/messages.properties file. I removed all the default.* from the file, and all the messages showed up fine and dandy. They shouldn’t have.
I tracked this down because the unique constraint threw an exception when trying to print the error message. The constraint checking takes place, but for some reason it can’t find default.not.unique.message in the file — even though it’s clearly there. It’s like it ignores all default.* messages when you’re not using groovy domains.
But, here’s the catch: if you define the constraint messages in the class.property.constraint method, they show up just fine. So clearly it’s READING and UNDERSTANDING the file. I just didn’t want to have to throw 1000 lines of messages in here for something I should be able to do with 3.
I’ve filed my first ever JIRA ticket for it. I get #3228. Yay me.