/** * 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 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)); }
/** * 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)); }
/** * INTERNAL: * Set the container policy on the selection query for this mapping. */ protected void setSelectionQueryContainerPolicy(ContainerPolicy containerPolicy) { ((DataReadQuery) getSelectionQuery()).setContainerPolicy(containerPolicy); }
/** * PUBLIC: * Initialize the state of the query. */ public DataReadQuery() { super(); this.shouldMaintainCache = false; this.resultType = MAP; setContainerPolicy(ContainerPolicy.buildDefaultPolicy()); }
/** * INTERNAL: * Set the container policy on the selection query for this mapping. */ @Override protected void setSelectionQueryContainerPolicy(ContainerPolicy containerPolicy) { ((DataReadQuery) getSelectionQuery()).setContainerPolicy(containerPolicy); }
/** * PUBLIC: * Initialize the state of the query. */ public DataReadQuery() { super(); this.shouldMaintainCache = false; this.resultType = MAP; setContainerPolicy(ContainerPolicy.buildDefaultPolicy()); }
/** * 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 * @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 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)); }
/** * 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 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)); }
/** * ADVANCED: * Configure the mapping to use a container policy. * The policy manages the access to the collection. */ @Override public void setContainerPolicy(ContainerPolicy containerPolicy) { this.containerPolicy = containerPolicy; if (this.selectionQuery.isDataReadQuery()){ ((DataReadQuery) getSelectionQuery()).setContainerPolicy(containerPolicy); } }
/** * INTERNAL: * Certain key mappings favor different types of selection query. Return the appropriate * type of selectionQuery * @return */ public ReadQuery buildSelectionQueryForDirectCollectionKeyMapping(ContainerPolicy containerPolicy){ DataReadQuery query = new DataReadQuery(); query.setSQLStatement(new SQLSelectStatement()); query.setContainerPolicy(containerPolicy); return query; }
/** * INTERNAL: * Certain key mappings favor different types of selection query. Return the appropriate * type of selectionQuery * @return */ public ReadQuery buildSelectionQueryForDirectCollectionKeyMapping(ContainerPolicy containerPolicy){ DataReadQuery query = new DataReadQuery(); query.setSQLStatement(new SQLSelectStatement()); query.setContainerPolicy(containerPolicy); return query; }
/** * INTERNAL: * Certain key mappings favor different types of selection query. Return the appropriate * type of selectionQuery. */ public ReadQuery buildSelectionQueryForDirectCollectionKeyMapping(ContainerPolicy containerPolicy){ DataReadQuery query = new DataReadQuery(); query.setSQLStatement(new SQLSelectStatement()); query.setContainerPolicy(containerPolicy); return query; }
/** * INTERNAL: * Certain key mappings favor different types of selection query. Return the appropriate * type of selectionQuery. */ public ReadQuery buildSelectionQueryForDirectCollectionKeyMapping(ContainerPolicy containerPolicy){ DataReadQuery query = new DataReadQuery(); query.setSQLStatement(new SQLSelectStatement()); query.setContainerPolicy(containerPolicy); return query; }
/** * Prepare and validate. * Allow subclasses to override. */ public void prepare(DatabaseQuery query, AbstractSession session) throws QueryException { if (query.isReadAllQuery() && (!query.isReportQuery()) && query.shouldUseWrapperPolicy()) { setElementDescriptor(query.getDescriptor()); //make sure DataReadQuery points to this container policy } else if (query.isDataReadQuery()) { ((DataReadQuery)query).setContainerPolicy(this); } }
/** * Prepare and validate. * Allow subclasses to override. */ public void prepare(DatabaseQuery query, AbstractSession session) throws QueryException { if (query.isReadAllQuery() && (!query.isReportQuery()) && query.shouldUseWrapperPolicy()) { setElementDescriptor(query.getDescriptor()); //make sure DataReadQuery points to this container policy } else if (query.isDataReadQuery()) { ((DataReadQuery)query).setContainerPolicy(this); } }
/** * Prepare and validate. * Allow subclasses to override. */ public void prepare(DatabaseQuery query, AbstractSession session) throws QueryException { if (query.isReadAllQuery() && (!query.isReportQuery()) && query.shouldUseWrapperPolicy()) { setElementDescriptor(query.getDescriptor()); //make sure DataReadQuery points to this container policy } else if (query.isDataReadQuery()) { ((DataReadQuery)query).setContainerPolicy(this); } }