/** * INTERNAL: * Prepare the mechanism. */ protected void prepareSelectAllRows() { getQueryMechanism().prepareSelectAllRows(); }
/** * INTERNAL: * Prepare the mechanism. */ protected void prepareSelectAllRows() { getQueryMechanism().prepareSelectAllRows(); }
/** * INTERNAL: * Prepare the mechanism. */ protected void prepareSelectAllRows() { getQueryMechanism().prepareSelectAllRows(); }
Vector classIndicators = ((ExpressionQueryMechanism)query.getQueryMechanism()).selectAllRowsFromTable(); concreteQuery.setDescriptor(concreteDescriptor); Vector concreteRows = ((ExpressionQueryMechanism)concreteQuery.getQueryMechanism()).selectAllRowsFromConcreteTable(); rows = Helper.concatenateVectors(rows, concreteRows);
/** * PUBLIC: * Specify the foreign-reference mapped attribute to be optimized in this query. * The query will execute normally, however when any of the batched parts is accessed, * the parts will all be read in a single query, * this allows all of the data required for the parts to be read in a single query instead of (n) queries. * This should be used when the application knows that it requires the part for all of the objects being read. * This can be used for one-to-one, one-to-many, many-to-many and direct collection mappings. * * The use of the expression allows for nested batch reading to be expressed. * <p>Example: query.addBatchReadAttribute("phoneNumbers") * * @see #addBatchReadAttribute(Expression) * @see ObjectLevelReadQuery#addJoinedAttribute(String) */ public void addBatchReadAttribute(String attributeName) { if (! getQueryMechanism().isExpressionQueryMechanism()){ throw QueryException.batchReadingNotSupported(this); } getBatchReadAttributeExpressions().add(getExpressionBuilder().get(attributeName)); }
/** * INTERNAL: * Select all rows from a abstract table descriptor. * This is accomplished by selecting for all of the concrete classes and then merging the rows. * This does not optimize using type select, as the type information is not known. * @return vector containing database rows. * @exception DatabaseException - an error has occurred on the database. */ protected Vector selectAllRowUsingCustomMultipleTableSubclassRead(ReadAllQuery query) throws DatabaseException { Vector rows = new Vector(); // CR#3701077, it must either have a filter only instances expression, or not have subclasses. // This method recurses, so even though this is only called when shouldReadSubclasses is true, it may be false for subclasses. if ((getOnlyInstancesExpression() != null) || (! shouldReadSubclasses())) { ReadAllQuery concreteQuery = (ReadAllQuery)query.clone(); concreteQuery.setReferenceClass(getDescriptor().getJavaClass()); concreteQuery.setDescriptor(getDescriptor()); Vector concreteRows = ((ExpressionQueryMechanism)concreteQuery.getQueryMechanism()).selectAllRowsFromConcreteTable(); rows = Helper.concatenateVectors(rows, concreteRows); } // Recursively collect all rows from all concrete children and their children. for (Enumeration childrenEnum = getChildDescriptors().elements(); childrenEnum.hasMoreElements();) { ClassDescriptor concreteDescriptor = (ClassDescriptor)childrenEnum.nextElement(); Vector concreteRows = concreteDescriptor.getInheritancePolicy().selectAllRowUsingCustomMultipleTableSubclassRead(query); rows = Helper.concatenateVectors(rows, concreteRows); } return rows; }
/** * INTERNAL: * Select all objects for a concrete descriptor. */ protected Object selectAllObjects(ReadAllQuery query) { ReadAllQuery concreteQuery = (ReadAllQuery) query.deepClone(); concreteQuery.setReferenceClass(descriptor.getJavaClass()); concreteQuery.setDescriptor(descriptor); // Avoid cloning the query again ... concreteQuery.setIsExecutionClone(true); concreteQuery.getExpressionBuilder().setQueryClassAndDescriptor(descriptor.getJavaClass(), descriptor); // Update the selection criteria if needed as well and don't lose // the translation row. if (concreteQuery.getQueryMechanism().getSelectionCriteria() != null) { //make sure query builder is used for the selection criteria as deepClone will create //two separate builders. concreteQuery.setSelectionCriteria(concreteQuery.getQueryMechanism().getSelectionCriteria().rebuildOn(concreteQuery.getExpressionBuilder())); return query.getSession().executeQuery(concreteQuery, query.getTranslationRow()); } return query.getSession().executeQuery(concreteQuery); }
builder.setSession(unitOfWork.getRootSession(null)); builder.setQueryClass(getReferenceClass()); if (getQueryMechanism().isExpressionQueryMechanism() && selectionCriteria.isLogicalExpression()) {
List rows = getQueryMechanism().selectAllRows(); setExecutionTime(System.currentTimeMillis());
rows = getQueryMechanism().selectAllRows(); this.executionTime = System.currentTimeMillis();
rows = getQueryMechanism().selectAllRows(); this.executionTime = System.currentTimeMillis();