开发者

SortedSet in Grails doesn't work

开发者 https://www.devze.com 2023-01-27 09:25 出处:网络
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:

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号