rsMeta );
rsMeta, session);
	private static void populateOdiResultSet( ResultSetPopulator populator,			OdiResultSetWrapper rsWrapper, SortSpec sortSpec )			throws DataException	{		Object resultSource = rsWrapper.getWrappedOdiResultSet( );		assert resultSource != null;		ResultSetCache smartCache = null;		BaseQuery query = populator.getQuery( );		IResultClass rsMeta = populator.getResultSetMetadata( );		if ( resultSource instanceof ResultSet )		{			smartCache = new SmartCache( new CacheRequest( query.getMaxRows( ),					query.getFetchEvents( ),					sortSpec,					populator.getEventHandler( ),					query.getDistinctValueFlag( ) ),					(ResultSet) resultSource,					rsMeta );		}		else if ( resultSource instanceof ICustomDataSet )		{			smartCache = new SmartCache( new CacheRequest( query.getMaxRows( ),					query.getFetchEvents( ),					sortSpec,					populator.getEventHandler( ),					query.getDistinctValueFlag( ) ),					new OdiAdapter( (ICustomDataSet) resultSource ),					rsMeta );		}		else if ( resultSource instanceof IDataSetPopulator )		{			smartCache = new SmartCache( new CacheRequest( query.getMaxRows( ),					query.getFetchEvents( ),					sortSpec,					populator.getEventHandler( ),					query.getDistinctValueFlag( ) ),					new OdiAdapter( (IDataSetPopulator) resultSource ),					rsMeta );		}		else if ( resultSource instanceof DataSetResultCache )		{			smartCache = new SmartCache( new CacheRequest( query.getMaxRows( ),					query.getFetchEvents( ),					sortSpec,					populator.getEventHandler( ),					false ), // must be true					new OdiAdapter( (DataSetResultCache) resultSource ),					rsMeta );		}		else if ( resultSource instanceof IResultIterator )		{			smartCache = new SmartCache( new CacheRequest( query.getMaxRows( ),					query.getFetchEvents( ),					sortSpec,					populator.getEventHandler( ),					false ), // must be true					new OdiAdapter( (IResultIterator) resultSource ),					rsMeta );		}		else if ( resultSource instanceof Object[] )		{			Object[] obs = (Object[]) resultSource;			smartCache = new SmartCache( new CacheRequest( query.getMaxRows( ),					query.getFetchEvents( ),					sortSpec,					populator.getEventHandler( ),					false ), // must be true					(ResultSetCache) obs[0],					( (int[]) obs[1] )[0],					( (int[]) obs[1] )[1],					rsMeta );		}		populator.getGroupProcessorManager( )				.getGroupCalculationUtil( )				.setResultSetCache( smartCache );		populator.setCache( smartCache );	}