1
(Case a.statusCd When 'ln' then 'loan' else a.status_cd end) as statusCd

为什么这个 jpa 查询返回错误?

整个查询字符串是

String qryString = "select"
                + " a.biblioId, " // 0
                + " a.copyId, " // 1
                + " a.copyDescr, "// 2
                + " a.employeeId, "// 3
                + " (Case a.statusCd When 'ln' then 'loan' else a.status_cd end) as statusCd, "// 4
                + " a.statusBeginDt, "// 5
                + " a.libListingCopyId, "// 6
                + " a.barcodeNbr, " // 7
                + " b.title, " // 8
                + " b.author " // 9
                + " from LibListingCopy a, LibListing b " + " where  "
                + curStmt + "and " + authStmt
                + "and a.biblioId = b.biblioId and a.siteId=b.siteId and "
                + bibStmt + " and  " + cpyStmt + " and " + libCodeStmt
                + " and " + accnNbrStmt;
4

1 回答 1

0

请检查您的查询,我认为同一字段有两个单独的字段名:

(Case a.statusCd When 'ln' then 'loan' else a.status_cd end) as statusCd

应该

(Case a.statusCd When 'ln' then 'loan' else a.statusCd end) as statusCd

或(对于另一种可能性)

(Case a.status_cd When 'ln' then 'loan' else a.status_cd end) as statusCd

所以失败可能是你的字段a.status_cd / a.statusCd的拼写

于 2013-09-06T07:35:28.690 回答