/** INTERNAL: Set the properties needed to be cascaded into the custom query. */ protected void prepareCustomQuery(DatabaseQuery customQuery) { ReadAllQuery customReadQuery = (ReadAllQuery) customQuery; customReadQuery.setContainerPolicy(getContainerPolicy()); customReadQuery.setCascadePolicy(getCascadePolicy()); customReadQuery.setShouldRefreshIdentityMapResult(shouldRefreshIdentityMapResult()); customReadQuery.setShouldMaintainCache(shouldMaintainCache()); customReadQuery.setShouldUseWrapperPolicy(shouldUseWrapperPolicy()); }
/** * PUBLIC: Configure the query to use an instance of the specified container class to hold the * result objects. The key used to index the value in the Map is the value returned by a call to * the specified zero-argument method. The method must be implemented by the class (or a * superclass) of the value to be inserted into the Map. * * <p>jdk1.2.x: The container class must implement (directly or indirectly) the Map interface. * * <p>jdk1.1.x: The container class must be a subclass of Hashtable. * * <p>The referenceClass must set before calling this method. */ public void useMapClass(Class concreteClass, String methodName) { // the reference class has to be specified before coming here if (getReferenceClass() == null) { throw QueryException.referenceClassMissing(this); } ContainerPolicy policy = ContainerPolicy.buildPolicyFor(concreteClass); policy.setKeyName(methodName, getReferenceClass().getName()); setContainerPolicy(policy); }
/** * PUBLIC: Use a CursoredStream as the result collection. * * @param initialReadSize the initial number of objects to read * @param pageSize the number of objects to read when more objects are needed from the database * @param sizeQuery a query that will return the size of the result set; this must be set if an * expression is not used (i.e. custom SQL) */ public void useCursoredStream(int initialReadSize, int pageSize, ValueReadQuery sizeQuery) { setContainerPolicy(new CursoredStreamPolicy(this, initialReadSize, pageSize, sizeQuery)); }
/** * PUBLIC: Use a CursoredStream as the result collection. * * @param initialReadSize the initial number of objects to read * @param pageSize the number of objects to read when more objects are needed from the database */ public void useCursoredStream(int initialReadSize, int pageSize) { setContainerPolicy(new CursoredStreamPolicy(this, initialReadSize, pageSize)); }
/** * PUBLIC: Configure the mapping to use an instance of the specified container class to hold the * target objects. * * <p>jdk1.2.x: The container class must implement (directly or indirectly) the Collection * interface. * * <p>jdk1.1.x: The container class must be a subclass of Vector. */ public void useCollectionClass(Class concreteClass) { // Set container policy. setContainerPolicy(ContainerPolicy.buildPolicyFor(concreteClass)); }
/** * PUBLIC: Return a new read all query. A reference class must be specified before execution. It * is better to provide the class and expression builder on construction to ensure a single * expression builder is used. If no selection criteria is specified this will read all objects of * the class from the database. */ public ReadAllQuery() { super(); setContainerPolicy(ContainerPolicy.buildDefaultPolicy()); }
/** * PUBLIC: Use a ScrollableCursor as the result collection. * * @param policy the scrollable cursor policy allows for additional result set options. Example: * <p>ScrollableCursorPolicy policy = new ScrollableCursorPolicy() * <p>policy.setResultSetType(ScrollableCursorPolicy.TYPE_SCROLL_INSENSITIVE); * <p>query.useScrollableCursor(policy); * <p> */ public void useScrollableCursor(ScrollableCursorPolicy policy) { policy.setQuery(this); setContainerPolicy(policy); }
/** * PUBLIC: Use a ScrollableCursor as the result collection. * * @param pageSize the number of elements to be read into a the cursor when more elements are * needed from the database. */ public void useScrollableCursor(int pageSize) { setContainerPolicy(new ScrollableCursorPolicy(this, pageSize)); }