为什么这段代码不能正常工作?
def classeInstrumento = classeInstrumentoService.getClasseInstrumento("value")
def instrumentoInstance = new Instrumento().addToClasseInstrumento(classeInstrumento)
我在控制台上收到此错误消息:
No signature of method: package.Instrumento.addToClasseInstrumento() is applicable for argument types: (package.ClasseInstrumento) values: [package.ClasseInstrumento : 5]
这是域结构
class ClasseInstrumento {
static hasMany = instrumentos: Instrumento
}
class Instrumento {
ClasseInstrumento idClasseInstrumento
static hasMany = [ativoDefs: AtivoDef,
futuroDefs: FuturoDef,
operacaoDefs: OperacaoDef]
static belongsTo = [ClasseInstrumento]
}
所以我预计它会起作用,但它没有:(
感谢您的回复!