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它的工作 –