Sometimes you need to define a getter in a domain class, for example when you want to concatenate persistent properties. But if you declare something like:
String getSomeValue(){
return aProperty + ' ' + aSecondProperty;
}
a org.hibernate.PropertyNotFoundException exception will be thrown, with message: Could not find a setter for property someValue in class <your_domain_class>.
Fortunately there is a way to prevent this kind of behavior, the getter should be declared:
transient def getSomeValue(){
return aProperty + ' ' + aSecondProperty;
}
in order to avoid that Grails process it as a property of the domain class.
No comments:
Post a Comment