(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;
答案 0 :(得分: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