/** * Read all rows from the database. * This is used only from query mechanism on a abstract-multiple table read. */ public Vector selectAllRowsFromConcreteTable() throws DatabaseException { ObjectLevelReadQuery query = (ObjectLevelReadQuery)this.query; // PERF: First check the subclass calls cache for the prepared call. // Must clear the translation row to avoid in-lining parameters unless not a prepared query. boolean shouldPrepare = query.shouldPrepare(); DatabaseCall call = null; if (shouldPrepare) { call = query.getConcreteSubclassCalls().get(query.getReferenceClass()); } if (call == null) { AbstractRecord translationRow = query.getTranslationRow(); if (shouldPrepare) { query.setTranslationRow(null); } setSQLStatement(buildConcreteSelectStatement()); // Must also build the call. super.prepareSelectAllRows(); if (shouldPrepare) { query.getConcreteSubclassCalls().put(query.getReferenceClass(), (DatabaseCall)this.call); query.setTranslationRow(translationRow); } } else { setCall(call); } return super.selectAllRows(); }
boolean shouldPrepare = query.shouldPrepare(); DatabaseCall call = null; if (shouldPrepare) {
boolean shouldPrepare = query.shouldPrepare(); DatabaseCall call = null; if (shouldPrepare) {
boolean shouldPrepare = query.shouldPrepare(); DatabaseCall call = null; if (shouldPrepare) {
boolean shouldPrepare = query.shouldPrepare(); DatabaseCall call = null; if (shouldPrepare) {
if (isPrepared() || (!shouldPrepare() && ((QueryByExampleMechanism)getQueryMechanism()).isParsed())) { ((QueryByExampleMechanism)getQueryMechanism()).setIsParsed(false); setSelectionCriteria(null);
Class javaClass = this.descriptor.getJavaClass(); boolean shouldPrepare = query.shouldPrepare(); if (shouldPrepare) { concreteQuery = (ObjectLevelReadQuery)query.getConcreteSubclassQueries().get(javaClass);
if (isPrepared() || (!shouldPrepare() && ((QueryByExampleMechanism)getQueryMechanism()).isParsed())) { ((QueryByExampleMechanism)getQueryMechanism()).setIsParsed(false); setSelectionCriteria(null);
Class javaClass = this.descriptor.getJavaClass(); boolean shouldPrepare = query.shouldPrepare(); if (shouldPrepare) { concreteQuery = (ObjectLevelReadQuery)query.getConcreteSubclassQueries().get(javaClass);
if (isPrepared() || (!shouldPrepare() && ((QueryByExampleMechanism)getQueryMechanism()).isParsed())) { ((QueryByExampleMechanism)getQueryMechanism()).setIsParsed(false); setSelectionCriteria(null);
/** * PUBLIC: * The QueryByExamplePolicy, is a useful to customize the query when Query By Example is used. * The policy will control what attributes should, or should not be included in the query. * When dealing with nulls, using special operations (notEqual, lessThan, like, etc.) * for comparison, or choosing to include certain attributes at all times, it is useful to modify * the policy accordingly. * <p>Once a query is executed you must make an explicit call to setQueryByExamplePolicy * when changing the policy, so the query will know to prepare itself again. * <p>There is a caution to setting both a selection criteria and an example object: * If you set the policy after execution you must also reset the selection criteria. * (This is because after execution the original criteria and Query By Example criteria are fused together, * and the former cannot be easily recovered). */ public void setQueryByExamplePolicy(QueryByExamplePolicy queryByExamplePolicy) { if (!getQueryMechanism().isQueryByExampleMechanism()) { setQueryMechanism(new QueryByExampleMechanism(this, getSelectionCriteria())); ((QueryByExampleMechanism)getQueryMechanism()).setQueryByExamplePolicy(queryByExamplePolicy); setIsPrepared(false); } else { ((QueryByExampleMechanism)getQueryMechanism()).setQueryByExamplePolicy(queryByExamplePolicy); // Must allow the query to be prepared again. if (isPrepared() || (!shouldPrepare() && ((QueryByExampleMechanism)getQueryMechanism()).isParsed())) { ((QueryByExampleMechanism)getQueryMechanism()).setIsParsed(false); setSelectionCriteria(null); // setIsPrepared(false) triggered by previous. } } setIsPrePrepared(false); }
/** * PUBLIC: * The QueryByExamplePolicy, is a useful to customize the query when Query By Example is used. * The policy will control what attributes should, or should not be included in the query. * When dealing with nulls, using special operations (notEqual, lessThan, like, etc.) * for comparison, or choosing to include certain attributes at all times, it is useful to modify * the policy accordingly. * <p>Once a query is executed you must make an explicit call to setQueryByExamplePolicy * when changing the policy, so the query will know to prepare itself again. * <p>There is a caution to setting both a selection criteria and an example object: * If you set the policy after execution you must also reset the selection criteria. * (This is because after execution the original criteria and Query By Example criteria are fused together, * and the former cannot be easily recovered). */ public void setQueryByExamplePolicy(QueryByExamplePolicy queryByExamplePolicy) { if (!getQueryMechanism().isQueryByExampleMechanism()) { setQueryMechanism(new QueryByExampleMechanism(this, getSelectionCriteria())); ((QueryByExampleMechanism)getQueryMechanism()).setQueryByExamplePolicy(queryByExamplePolicy); setIsPrepared(false); } else { ((QueryByExampleMechanism)getQueryMechanism()).setQueryByExamplePolicy(queryByExamplePolicy); // Must allow the query to be prepared again. if (isPrepared() || (!shouldPrepare() && ((QueryByExampleMechanism)getQueryMechanism()).isParsed())) { ((QueryByExampleMechanism)getQueryMechanism()).setIsParsed(false); setSelectionCriteria(null); // setIsPrepared(false) triggered by previous. } } setIsPrePrepared(false); }
/** * PUBLIC: * The QueryByExamplePolicy, is a useful to customize the query when Query By Example is used. * The policy will control what attributes should, or should not be included in the query. * When dealing with nulls, using special operations (notEqual, lessThan, like, etc.) * for comparison, or choosing to include certain attributes at all times, it is useful to modify * the policy accordingly. * <p>Once a query is executed you must make an explicit call to setQueryByExamplePolicy * when changing the policy, so the query will know to prepare itself again. * <p>There is a caution to setting both a selection criteria and an example object: * If you set the policy after execution you must also reset the selection criteria. * (This is because after execution the original criteria and Query By Example criteria are fused together, * and the former cannot be easily recovered). */ public void setQueryByExamplePolicy(QueryByExamplePolicy queryByExamplePolicy) { if (!getQueryMechanism().isQueryByExampleMechanism()) { setQueryMechanism(new QueryByExampleMechanism(this, getSelectionCriteria())); ((QueryByExampleMechanism)getQueryMechanism()).setQueryByExamplePolicy(queryByExamplePolicy); setIsPrepared(false); } else { ((QueryByExampleMechanism)getQueryMechanism()).setQueryByExamplePolicy(queryByExamplePolicy); // Must allow the query to be prepared again. if (isPrepared() || (!shouldPrepare() && ((QueryByExampleMechanism)getQueryMechanism()).isParsed())) { ((QueryByExampleMechanism)getQueryMechanism()).setIsParsed(false); setSelectionCriteria(null); // setIsPrepared(false) triggered by previous. } } setIsPrePrepared(false); }
batchQuery.setShouldPrepare(query.shouldPrepare());
batchQuery.setShouldPrepare(query.shouldPrepare());