我有这样的域类:
class ServicesGroup {
Long id
String name
String description
String toString(){
return name
}
static mapping = {
version false
table 'root.services_groups'
id column:'group_id'
name column:'group_name'
description column:'group_desc'
}
}
和
class Step {
Long id
ServicesGroup service
String stepType
Integer stepFrom
Integer stepTo
static constraints = {
stepType(inList:['operator', 'client'])
}
static mapping = {
version false
table 'bill.steps'
service column:'service_group_id'
}
}
关系是 - 一个 ServicesGroup 条目可以有多个 Step 实例。
但是,当在我的控制器中时,我尝试
Step.findByService(3)
我得到:
"org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: Step.findByService() is applicable for argument types: (java.lang.Integer) values: {3}"
但是,当我更改 Step 域类字段时
ServicesGroup service
简单地
Long service
有用。
这里发生了什么?