/** * INTERNAL: * Certain key mappings favor different types of selection query. Return the appropriate * type of selectionQuery * @return */ @Override public ReadQuery buildSelectionQueryForDirectCollectionKeyMapping(ContainerPolicy containerPolicy){ ReadAllQuery query = new ReadAllQuery(); query.setReferenceClass(referenceClass); query.setDescriptor(getReferenceDescriptor()); query.setContainerPolicy(containerPolicy); return query; }
/** * INTERNAL: * Certain key mappings favor different types of selection query. Return the appropriate * type of selectionQuery * @return */ @Override public ReadQuery buildSelectionQueryForDirectCollectionKeyMapping(ContainerPolicy containerPolicy){ ReadAllQuery query = new ReadAllQuery(); query.setReferenceClass(referenceClass); query.setDescriptor(getReferenceDescriptor()); 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){ ReadAllQuery query = new ReadAllQuery(); query.setReferenceClass(referenceClass); query.setDescriptor(getReferenceDescriptor()); query.setContainerPolicy(containerPolicy); return query; }
/** * INTERNAL: Generates the read all stored procedure for this descriptor */ protected StoredProcedureDefinition generateReadAllStoredProcedure(ClassDescriptor descriptor) { ReadAllQuery readAllQuery = new ReadAllQuery(); readAllQuery.setDescriptor(descriptor); readAllQuery.setReferenceClass(descriptor.getJavaClass()); return generateObjectStoredProcedure(readAllQuery, descriptor.getPrimaryKeyFields(), "RALL_"); }
concreteQuery.setDescriptor(concreteDescriptor);
/** * INTERNAL: Generates the read all stored procedure for this descriptor */ protected StoredProcedureDefinition generateReadAllStoredProcedure(ClassDescriptor descriptor) { ReadAllQuery readAllQuery = new ReadAllQuery(); readAllQuery.setDescriptor(descriptor); readAllQuery.setReferenceClass(descriptor.getJavaClass()); return generateObjectStoredProcedure(readAllQuery, descriptor.getPrimaryKeyFields(), "RALL_"); }
/** * INTERNAL: Generates the read all stored procedure for this descriptor */ protected StoredProcedureDefinition generateReadAllStoredProcedure(ClassDescriptor descriptor) { ReadAllQuery readAllQuery = new ReadAllQuery(); readAllQuery.setDescriptor(descriptor); readAllQuery.setReferenceClass(descriptor.getJavaClass()); return generateObjectStoredProcedure(readAllQuery, descriptor.getPrimaryKeyFields(), "RALL_"); }
/** * INTERNAL: Generates the read all stored procedure for this mapping */ protected StoredProcedureDefinition generateOneToManyMappingReadProcedure(OneToManyMapping mapping) { ClassDescriptor targetDescriptor = mapping.getReferenceDescriptor(); ReadAllQuery readAllQuery = new ReadAllQuery(); readAllQuery.setDescriptor(targetDescriptor); readAllQuery.setReferenceClass(targetDescriptor.getJavaClass()); readAllQuery.setSelectionCriteria(mapping.getSelectionCriteria()); return generateOneToManyMappingProcedures(mapping, readAllQuery, mapping.getTargetForeignKeyToSourceKeys(), "R_1M_"); }
/** * 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: Generates the read all stored procedure for this mapping */ protected StoredProcedureDefinition generateOneToManyMappingReadProcedure(OneToManyMapping mapping) { ClassDescriptor targetDescriptor = mapping.getReferenceDescriptor(); ReadAllQuery readAllQuery = new ReadAllQuery(); readAllQuery.setDescriptor(targetDescriptor); readAllQuery.setReferenceClass(targetDescriptor.getJavaClass()); readAllQuery.setSelectionCriteria(mapping.getSelectionCriteria()); return generateOneToManyMappingProcedures(mapping, readAllQuery, mapping.getTargetForeignKeyToSourceKeys(), "R_1M_"); }
/** * INTERNAL: Generates the read all stored procedure for this mapping */ protected StoredProcedureDefinition generateOneToManyMappingReadProcedure(OneToManyMapping mapping) { ClassDescriptor targetDescriptor = mapping.getReferenceDescriptor(); ReadAllQuery readAllQuery = new ReadAllQuery(); readAllQuery.setDescriptor(targetDescriptor); readAllQuery.setReferenceClass(targetDescriptor.getJavaClass()); readAllQuery.setSelectionCriteria(mapping.getSelectionCriteria()); return generateOneToManyMappingProcedures(mapping, readAllQuery, mapping.getTargetForeignKeyToSourceKeys(), "R_1M_"); }
this.readAllQuery.setDescriptor(getDescriptor()); this.readAllQuery.setReferenceClassName(getDescriptor().getJavaClassName()); try {
this.readAllQuery.setDescriptor(getDescriptor()); this.readAllQuery.setReferenceClassName(getDescriptor().getJavaClassName()); try {
this.readAllQuery.setDescriptor(getDescriptor()); this.readAllQuery.setReferenceClassName(getDescriptor().getJavaClassName()); try {
getReadAllQuery().setDescriptor(descriptor);
getReadAllQuery().setDescriptor(descriptor);
getReadAllQuery().setDescriptor(descriptor);
/** * 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); }
ReadAllQuery batchQuery = new ReadAllQuery(); batchQuery.setReferenceClass(getReferenceClass()); batchQuery.setDescriptor(getReferenceDescriptor()); batchQuery.setSession(query.getSession());
ReadAllQuery batchQuery = new ReadAllQuery(this.referenceClass, builder); batchQuery.setName(getAttributeName()); batchQuery.setDescriptor(getReferenceDescriptor()); batchQuery.setSession(query.getSession()); batchQuery.setShouldUseSerializedObjectPolicy(query.shouldUseSerializedObjectPolicy());