title: From List to int. Unable to convert a query result
body: <p>I have this query:</p>
  
  <pre><code>select count(*) from {Order as or join CustomerOrderStatus as os on
  {or:CustomerOrderStatus}={os:pk} join OrderEntry as oe on
  {or.pk}={oe.order} join PurchaseAmount as pa on
  {or.pointOfSale}={pa.purchaseAmountOwner} join PurchaseAmountTimeSlice
  as ts on {pa.pk}={ts.purchaseamount}} where {or:company} in
  (8796093710341) and {or:pointOfSale} in (8796097413125)
  </code></pre>
  
  <p>I have this code in Java to retrieve result:</p>
  
  <pre><code>FlexibleSearchQuery query = new FlexibleSearchQuery(queryBuilder.toString());
  List&lt;Integer&gt; result = new ArrayList&lt;Integer&gt;();
  result = getFlexibleSearchService().&lt;Integer&gt; search(query).getResult();
  </code></pre>
  
  <p>I want to take the int value of the count from the result list.
  If I write <code>result.get(0)</code> I obtain an error <code>IllegalArgumentException</code>:</p>
  
  <pre><code>java.lang.IllegalArgumentException: invalid pks [4] - unknown typecode 0
      at de.hybris.platform.core.WrapperFactory.getCachedItems(WrapperFactory.java:304)
      at de.hybris.platform.core.LazyLoadItemList.loadPage(LazyLoadItemList.java:230)
      at de.hybris.platform.servicelayer.search.impl.LazyLoadModelList.loadPage(LazyLoadModelList.java:60)
      at de.hybris.platform.core.LazyLoadItemList.switchPage(LazyLoadItemList.java:219)
      at de.hybris.platform.core.LazyLoadItemList.switchBufferedPageNoLock(LazyLoadItemList.java:475)
      at de.hybris.platform.core.LazyLoadItemList.switchBufferedPageSynchronized(LazyLoadItemList.java:467)
      at de.hybris.platform.core.LazyLoadItemList.switchBufferedPage(LazyLoadItemList.java:462)
      at de.hybris.platform.core.LazyLoadItemList.getOrSwitchBufferedPage(LazyLoadItemList.java:453)
      at de.hybris.platform.core.LazyLoadItemList.getOrSwitchBufferedPage(LazyLoadItemList.java:433)
      at de.hybris.platform.core.LazyLoadItemList.getBuffered(LazyLoadItemList.java:111)
      at de.hybris.platform.core.LazyLoadItemList.get(LazyLoadItemList.java:97)
      at java.util.AbstractList$Itr.next(AbstractList.java:358)
      at de.hybris.platform.core.internal.BaseLazyLoadItemList$1.next(BaseLazyLoadItemList.java:180)
      at java.util.AbstractCollection.toArray(AbstractCollection.java:195)
      at java.util.Collections$UnmodifiableCollection.toArray(Collections.java:1059)
  </code></pre>
  
  <p>How I can get the int value?</p>