* This may return the value directly in case of a simple key or will be used as the FK to load a related entity.
*/
public List<Object> createMapComponentsFromSerializableKeyInfo(Object[] keyInfo, AbstractSession session){
List<Object> orderedResult = new ArrayList<Object>(keyInfo.length);
Map<Object, Object> fromCache = session.getIdentityMapAccessor().getAllFromIdentityMapWithEntityPK(keyInfo, referenceDescriptor);
DatabaseRecord translationRow = new DatabaseRecord();
List foreignKeyValues = new ArrayList(keyInfo.length - fromCache.size());
CacheKeyType cacheKeyType = referenceDescriptor.getCacheKeyType();
for (int index = 0; index < keyInfo.length; ++index){
Object pk = keyInfo[index];
if (!fromCache.containsKey(pk)){
if (cacheKeyType == CacheKeyType.CACHE_ID){
foreignKeyValues.add(Arrays.asList(((CacheId)pk).getPrimaryKey()));
}else{
foreignKeyValues.add(pk);
}
}
}
if (!foreignKeyValues.isEmpty()){
translationRow.put(ForeignReferenceMapping.QUERY_BATCH_PARAMETER, foreignKeyValues);
ReadAllQuery query = new ReadAllQuery(referenceDescriptor.getJavaClass());
query.setIsExecutionClone(true);
query.setTranslationRow(translationRow);
query.setSession(session);
query.setSelectionCriteria(referenceDescriptor.buildBatchCriteriaByPK(query.getExpressionBuilder(), query));