0
ProductViewerController.groovy我试图让使用Grails和Groovy的标准从postgreySQL基础数据,但我面临的问题,同时accesing列表foregin密钥ID
class ProductViewerController {
def index(Integer id) {
def result=ProductLoader.createCriteria().list {
eq("product_barcode",id)
}
result.each {
notes->println "${notes}"
}
render(view:'index.gsp')
}
}
ProductLoader.groovy(Model类)
class ProductLoader { String store double price String notes static belongsTo =[product_barcode : Product] static constraints = { store() price() notes() } }
我试图让外国k的基础上的数据然后EY ID获得ClassCastException异常:
感谢gregorr它的工作 –