今天客戶方服務器上突然有一個功能保存了,查看日志信息后發現,錯誤信息:
Could not instantiate class XXX from tuple at AliasToBeanConstructorResultTransformer...
Google了很久才發現有可能是HQL語句中別名的問題,具體原因未知,現在處理辦法是,將下面的語句中的別名去掉:
StringBuffer hql = new StringBuffer("select new ContractItem(l, "
+ " pi.unitPrice, " + " pi.currencyType, " + "pi.currencyTypeDisplay," + " pi.units, "
+ " sum(pi.quantity + pi.adjQuantity), " + " pp, " + " pi.task) "
+ " from PurchasePlanItem pi " + " join pi.purchasePlan pp"
+ " join pi.priorList l " + " where l.supplierNo = ? "
+ " and pp.id in (");
具體是否可以解決,還要看一會兒的部署情況。
客戶虐我千百遍,我待客戶如初戀!