I want to use a SortedSet
with Grails, but all I get is a MissingMethodException.
The class that contains the sorted set looks like this:
class SystemUser {
SortedSet organisations
// ... some other fields
static hasMany = [organisations: Organisation]
static belongsTo = [Organisation]
}
... and the class implementing Comparable
lik开发者_运维技巧e this:
class Organisation implements Comparable {
String name
// ... some other fields
static hasMany = [users: SystemUser]
int compareTo(other) {
return name.comparteTo(other.name)
}
}
When I try to save a SystemUser object I get this Exception message:
groovy.lang.MissingMethodException: No signature of method: java.lang.String.comparteTo() is applicable for argument types: (java.lang.String) values: [ABC]
Possible solutions: compareTo(java.lang.String), compareTo(java.lang.Object)
My example is almost identical with the example from the official reference.
No signature of method: java.lang.String.comparteTo() is applicable for argument types
See the problem now?
精彩评论