/** * INTERNAL: The results are *not* in a cursor, build the collection. Cache the results in * temporaryCachedQueryResults. */ protected Object executeNonCursor() throws DatabaseException { Vector rows = getQueryMechanism().executeSelect(); ContainerPolicy containerPolicy = getContainerPolicy(); Object results = null; if (useAbstractRecord) { results = containerPolicy.buildContainerFromVector(rows, getSession()); } else { results = containerPolicy.containerInstance(rows.size()); for (Iterator rowsEnum = rows.iterator(); rowsEnum.hasNext(); ) { containerPolicy.addInto( ((AbstractRecord) rowsEnum.next()).getValues(), results, getSession()); } } // Bug 6135563 - cache DataReadQuery results verbatim, as ObjectBuilder is not invoked cacheResult(results); return results; }
/** PUBLIC: Initialize the state of the query. */ public DataReadQuery() { super(); this.shouldMaintainCache = false; useAbstractRecord = true; setContainerPolicy(ContainerPolicy.buildPolicyFor(ClassConstants.Vector_class)); }
/** * PUBLIC: Configure the query to use an instance of the specified container class to hold the * target objects. The container class must implement (directly or indirectly) the Collection * interface. */ public void useCollectionClass(Class concreteClass) { setContainerPolicy(ContainerPolicy.buildPolicyFor(concreteClass)); }