从多个表中检索数据时的java.lang.classcastexception

时间:2016-03-21 12:59:13

标签: java hibernate

我想从hibernate中的不同表中获取不同的列。 我的疑问是:

@NamedQuery(name="findAllfundSalesCreditCalc",query=" select distinct SF.subFundName, SF.id, case when FCM.subFundId is null "
                +" then 'Not yet added' else 'Already exists' end as ExistsOrNot,CCM.calculationMethodName," 
                +" FCM.effectiveFromDate, FCM.effectiveToDate,FCM.paymentFrequencyId,"
                +" FCM.firstPaymentDate from FundSalesCreditCalcMethod FCM ,SubFund SF , Class C ,"
                +" SC_Class SCC, SalesCreditCalcMethod CCM where SF.id = FCM.subFundId and "
                +" CCM.id = FCM.salesCreditCalcMethodId and "
                +" C.id = SF.id and "
                +" SCC.classId = C.id")

我正在检索列表中的数据。

List<FundSalesCreditCalcMethod> fundSalesCreditCalc = getFundSalesCreditCalcMethodDao().getFundSalesCreditCalc(); 

public List<FundSalesCreditCalcMethod> getFundSalesCreditCalc() {
        return this.entityManager.createNamedQuery("findAllfundSalesCreditCalc").getResultList();
    }

public List<FundSalesCreditCalcMethodDTO> getFundSalesCreditCalculation() {
/*      List<Object> fundSalesCreditCalc = getFundSalesCreditCalcMethodDao().getFundSalesCreditCalc();*/
        List<FundSalesCreditCalcMethod> fundSalesCreditCalc = getFundSalesCreditCalcMethodDao().getFundSalesCreditCalc();
        List<FundSalesCreditCalcMethodDTO> fundSalesCreditCalcMethodDtos = new ArrayList<FundSalesCreditCalcMethodDTO>();
        for(FundSalesCreditCalcMethod fundSalesCredit: fundSalesCreditCalc) {
            fundSalesCreditCalcMethodDtos.add(DTOCreator.createfundSalesCreditCalcDTO(fundSalesCredit));
        }
        return fundSalesCreditCalcMethodDtos;
    }

这是错误:java.lang.classcastexception

0 个答案:

没有答案