gorm - Grails addTo* with result of database -
why code not work fine?
def classeinstrumento = classeinstrumentoservice.getclasseinstrumento("value") def instrumentoinstance = new instrumento().addtoclasseinstrumento(classeinstrumento)
i receive error message on console:
no signature of method: package.instrumento.addtoclasseinstrumento() applicable argument types: (package.classeinstrumento) values: [package.classeinstrumento : 5]
and domains structure
class classeinstrumento { static hasmany = instrumentos: instrumento } class instrumento { classeinstrumento idclasseinstrumento static hasmany = [ativodefs: ativodef, futurodefs: futurodef, operacaodefs: operacaodef] static belongsto = [classeinstrumento] }
so expected worked, didn't :(
thanks replies!
instrumento
belongsto classeinstrumento
.
which means classeinstrumento
parent , instrumento
child of classeinstrumento
(signified hasmany in classeinstrumento
)
addto* used parent towards child means
"add parent foreign_key reference child", means
classeinstrumento.addtoinstrumentos(new instrumento())
will work , not former approach use.
Comments
Post a Comment