播放Anorm表列别名无法找到

时间:2014-04-15 09:34:32

标签: mysql scala jdbc playframework anorm

我在Play Anorm中使用MySQL JDBC存在别名问题。错误是

[RuntimeException: qty not found, available columns : ri_id, ri_id, detailri.po_id, po_id, detailri.product_id, product_id, product.description, description, detailri.received_qty, received_qty, qty, qty]

我使用别名运行了其他查询,幸运的是我没有任何问题但是对于此查询它显示错误..

查询:

"""select CAST(ri_id as CHAR(10)) as ri_id, detailri.po_id, detailri.product_id, description, detailri.qty as received_qty, CAST(detailpo.qty as CHAR(10)) as qty from detailri, product, detailpo where ri_id = {idRI} and detailri.po_id = detailpo.po_id and detailri.product_id = product.id and detailpo.product_id = product.id group by detailri.ri_id, detailri.po_id, detailri.product_id"""

分析器:

val PIdetailParser: RowParser[PIdetail]={
    get[String] ("ri_id") ~
    get[String] ("po_id") ~
    get[String] ("product_id") ~
    get[String] ("description") ~
    get[Int] ("received_qty") ~
    get[String] ("qty ") map({
        case ri_id~po_id~product_id~description~received_qty~qty => PIdetail(ri_id,po_id,product_id,description,received_qty,qty)
    })
}

所以,我已经将useOldAliasMetadataBehavior=true添加到我的JDBC(application.conf)中,但是没有运气..真的需要你的帮助..

0 个答案:

没有答案