cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Flexi Query returns invalid/incomplete result for custom resultClassList

Former Member
0 Likes
332

Hi I am facing an issue with flexi query when trying to return a custom ResultClassList in java programatically. I am getting below exception at line 16 in the snippet:

alt textjava.lang.IllegalArgumentException: invalid pks [12, 44] - unknown typecode 0

The result is as expected when executing the same query from HAC.

Code Snippet:

 public int calculateTrueSapQty(final String cfn, final String soldTo, final FlexibleSearchQuery query, int trueSapQty) {
     final FlexibleSearchQuery queryForOpenQty = new FlexibleSearchQuery("SELECT (CASE WHEN  {openShipQty}  IS NULL THEN 0 ELSE {openShipQty} END), (CASE WHEN  {openReturnQty}  IS NULL THEN 0 ELSE {openReturnQty} END) FROM {HCCB2BOpenOrder} WHERE {productCfn}=?productCfn AND {ssp}=?soldTo");
     queryForOpenQty.addQueryParameter(_CFN2, cfn);
     queryForOpenQty.addQueryParameter(_SOLD_TO, soldTo);
     final Class<?>[] resultClass = { int.class,int.class };
             query.setResultClassList(Arrays.asList(resultClass));
     List<List<?>> resultList = null;
     this.searchRestrictionService.disableSearchRestrictions();
     final SearchResult<List<?>> searchResultForOpenQty = this
             .getFlexibleSearchService().search(queryForOpenQty);
     this.searchRestrictionService.enableSearchRestrictions();
     resultList = searchResultForOpenQty.getResult();
     if (CollectionUtils.isNotEmpty(resultList)) {
         int openShipQty = 0;
         int openRtrQty = 0;
         for(List<?> ooQuantities : resultList){
             openShipQty += ((Integer)ooQuantities.get(0)).intValue();
             openRtrQty += ((Integer)ooQuantities.get(1)).intValue();
         }
         trueSapQty += openShipQty + openRtrQty;
     }
     return trueSapQty;
 }


Accepted Solutions (0)

Answers (0)