How do I prevent a Grails domain from being updated or deleted?
grails, grails-orm
Solution
One approach is to add two methods, `beforeUpdate` and `beforeDelete`, to your Grails domain that both return `false`. The available GORM event methods are described in the documentation here.
class Example {
def beforeUpdate() {
return false;
}
def beforeDelete() {
return false;
}
}
Problem
Once the domain is created and saved, I want to enforce that it doesn't get updated or deleted. What's the simplest and most effective way to achieve this?