Java ouaf上的类强制转换异常

时间:2018-08-08 14:01:45

标签: java exception casting

  

java.lang.ClassCastException:   com.splwg.ccb.domain.fieldorder.fieldActivity.entity.FieldActivity_Id   无法转换为com.splwg.base.api.QueryResultRow   com.splwg.cm.domain.meterread.batch.CmCompleteReadOnlyFAsBatch.getJobWork(CmCompleteReadOnlyFAsBatch.java:115)

我从日志中得到以下错误。任何想法如何解决这个问题?这是发现错误的特定代码。

    List<QueryResultRow> fieldActivities = retrieveFieldActivities ();
    List<ThreadWorkUnit> workUnits = new ArrayList<ThreadWorkUnit>();
            ThreadWorkUnit workUnit = null;
            for(QueryResultRow row : fieldActivities) {
                FieldActivity_Id faId = (FieldActivity_Id) row.getId("id", FieldActivity.class);
                workUnit = new ThreadWorkUnit();
                workUnit.setPrimaryId(faId);
                workUnits.add(workUnit);
            }
    return createJobWorkForThreadWorkUnitList (workUnits);

private List<QueryResultRow> retrieveFieldActivities () {

        StringBuffer queryStringBuffer = new StringBuffer();
        queryStringBuffer.append(" FROM FieldActivity as fa, FieldActivityCharacteristic as fac");
        queryStringBuffer.append(" WHERE fa.fieldActivityType = :faTypesForQuery");
        queryStringBuffer.append(" AND fa.fieldActivityStatus = :faStatusFlg");
        queryStringBuffer.append(" AND fa.id = fac.id.fieldActivity");
        queryStringBuffer.append(" AND fac.id.characteristicType = :readReqCharType");
        queryStringBuffer.append(" AND NOT EXISTS (");
        queryStringBuffer.append(" SELECT fa.id");
        queryStringBuffer.append(" FROM FieldActivityCharacteristic as fac, FieldActivity as fa");
        queryStringBuffer.append(" WHERE fac.id.fieldActivity = fa.id");
        queryStringBuffer.append(" AND fac.id.characteristicType = :readPostCharType)");

        Query<QueryResultRow> fieldActivityQuery = createQuery(
                queryStringBuffer.toString(), "fieldActivityQuery");

        FieldActivityType_Id fieldActTypeForQueryId = new FieldActivityType_Id(fieldActTypesForQuery);

        fieldActivityQuery.bindId("faTypesForQuery", fieldActTypeForQueryId);
        fieldActivityQuery.bindLookup("faStatusFlg", pendingStatus);
        fieldActivityQuery.bindId("readReqCharType", readRequestedCharType);
        fieldActivityQuery.bindId("readPostCharType", readPostedCharType);

        fieldActivityQuery.addResult("fieldAct", "fa.id");

        logger.info("faTypesForQuery:" + fieldActTypeForQueryId);
        logger.info("faStatusFlg:" + pendingStatus);
        logger.info("readReqCharType:" + readRequestedCharType);
        logger.info("readPostCharType:" + readPostedCharType);

        List<QueryResultRow> fieldActivityRows = fieldActivityQuery.list();

        return fieldActivityRows;       
    }

for(QueryResultRow row : fieldActivities)是第115行!

0 个答案:

没有答案