on 2018 Feb 09 10:42 PM
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;
}


Request clarification before answering.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.