/** * PUBLIC: * Add the ordering expression. This allows for ordering across relationships or functions. * Example: readAllQuery.addOrdering(expBuilder.get("address").get("city").toUpperCase().descending()) */ public void addOrdering(Expression orderingExpression) { getOrderByExpressions().add(orderingExpression); //Bug2804042 Must un-prepare if prepared as the SQL may change. setIsPrepared(false); setShouldOuterJoinSubclasses(true); }
/** * PUBLIC: * Add the ordering expression. This allows for ordering across relationships or functions. * Example: readAllQuery.addOrdering(expBuilder.get("address").get("city").toUpperCase().descending()) */ public void addOrdering(Expression orderingExpression) { getOrderByExpressions().add(orderingExpression); //Bug2804042 Must un-prepare if prepared as the SQL may change. setIsPrepared(false); setShouldOuterJoinSubclasses(true); }
/** * PUBLIC: * Add the ordering expression. This allows for ordering across relationships or functions. * Example: readAllQuery.addOrdering(expBuilder.get("address").get("city").toUpperCase().descending()) */ public void addOrdering(Expression orderingExpression) { getOrderByExpressions().add(orderingExpression); //Bug2804042 Must un-prepare if prepared as the SQL may change. setIsPrepared(false); setShouldOuterJoinSubclasses(true); }
DatabaseQuery applyToDatabaseQuery(Object valueToApply, DatabaseQuery query, ClassLoader loader, AbstractSession activeSession) { if (query.isObjectLevelReadQuery()) { ((ObjectLevelReadQuery)query).setShouldOuterJoinSubclasses(((Boolean)valueToApply).booleanValue()); } else { throw new IllegalArgumentException(ExceptionLocalization.buildMessage("ejb30-wrong-type-for-query-hint",new Object[]{getQueryId(query), name, getPrintValue(valueToApply)})); } return query; } }
/** * INTERNAL: * Return relation table locking clause. */ public void setRelationTableLockingClause(ObjectLevelReadQuery targetQuery, ObjectBuildingQuery sourceQuery) { ForUpdateOfClause lockingClause = new ForUpdateOfClause(); lockingClause.setLockMode(sourceQuery.getLockMode()); FieldExpression exp = (FieldExpression)targetQuery.getExpressionBuilder().getTable(this.relationTable).getField(this.sourceRelationKeyFields.get(0)); lockingClause.addLockedExpression(exp); targetQuery.setLockingClause(lockingClause); // locking clause is not compatible with DISTINCT targetQuery.setShouldOuterJoinSubclasses(true); }
/** * INTERNAL: * Return relation table locking clause. */ public void setRelationTableLockingClause(ObjectLevelReadQuery targetQuery, ObjectBuildingQuery sourceQuery) { ForUpdateOfClause lockingClause = new ForUpdateOfClause(); lockingClause.setLockMode(sourceQuery.getLockMode()); FieldExpression exp = (FieldExpression)targetQuery.getExpressionBuilder().getTable(this.relationTable).getField(this.sourceRelationKeyFields.get(0)); lockingClause.addLockedExpression(exp); targetQuery.setLockingClause(lockingClause); // locking clause is not compatible with DISTINCT targetQuery.setShouldOuterJoinSubclasses(true); }
/** * INTERNAL: * Return relation table locking clause. */ public void setRelationTableLockingClause(ObjectLevelReadQuery targetQuery, ObjectBuildingQuery sourceQuery) { ForUpdateOfClause lockingClause = new ForUpdateOfClause(); lockingClause.setLockMode(sourceQuery.getLockMode()); FieldExpression exp = (FieldExpression)targetQuery.getExpressionBuilder().getTable(this.relationTable).getField(this.sourceRelationKeyFields.get(0)); lockingClause.addLockedExpression(exp); targetQuery.setLockingClause(lockingClause); // locking clause is not compatible with DISTINCT targetQuery.setShouldOuterJoinSubclasses(true); }
/** * INTERNAL: * Prepare and validate. */ public void prepare(DatabaseQuery query, AbstractSession session) throws QueryException { super.prepare(query, session); setQuery((ReadQuery)query); ClassDescriptor descriptor = query.getDescriptor(); // ReadAllQuery has a descriptor, DataReadQuery does not. if (descriptor != null) { // Interface queries cannot use cursors. if (descriptor.isDescriptorForInterface()) { throw QueryException.noCursorSupport(query); } // Ensure inheritance queries outer join subclasses. if (query.isObjectLevelReadQuery() && descriptor.hasInheritance()) { ((ObjectLevelReadQuery) query).setShouldOuterJoinSubclasses(true);; } } query.getQueryMechanism().prepareCursorSelectAllRows(); }
/** * INTERNAL: * Prepare and validate. */ public void prepare(DatabaseQuery query, AbstractSession session) throws QueryException { super.prepare(query, session); setQuery((ReadQuery)query); ClassDescriptor descriptor = query.getDescriptor(); // ReadAllQuery has a descriptor, DataReadQuery does not. if (descriptor != null) { // Interface queries cannot use cursors. if (descriptor.isDescriptorForInterface()) { throw QueryException.noCursorSupport(query); } // Ensure inheritance queries outer join subclasses. if (query.isObjectLevelReadQuery() && descriptor.hasInheritance()) { ((ObjectLevelReadQuery) query).setShouldOuterJoinSubclasses(true);; } } query.getQueryMechanism().prepareCursorSelectAllRows(); }
/** * INTERNAL: * Prepare and validate. */ public void prepare(DatabaseQuery query, AbstractSession session) throws QueryException { super.prepare(query, session); setQuery((ReadQuery)query); ClassDescriptor descriptor = query.getDescriptor(); // ReadAllQuery has a descriptor, DataReadQuery does not. if (descriptor != null) { // Interface queries cannot use cursors. if (descriptor.isDescriptorForInterface()) { throw QueryException.noCursorSupport(query); } // Ensure inheritance queries outer join subclasses. if (query.isObjectLevelReadQuery() && descriptor.hasInheritance()) { ((ObjectLevelReadQuery) query).setShouldOuterJoinSubclasses(true);; } } query.getQueryMechanism().prepareCursorSelectAllRows(); }
setShouldOuterJoinSubclasses(getMaxRows()>0 || getFirstResult()>0 || (this.descriptor != null && this.descriptor.hasInheritance() && (this.descriptor.getInheritancePolicy().shouldOuterJoinSubclasses()|| this.getExpressionBuilder().isTreatUsed()) ));
setShouldOuterJoinSubclasses(getMaxRows()>0 || getFirstResult()>0 || (this.descriptor != null && this.descriptor.hasInheritance() && (this.descriptor.getInheritancePolicy().shouldOuterJoinSubclasses()|| this.getExpressionBuilder().isTreatUsed()) ));
setShouldOuterJoinSubclasses(getMaxRows()>0 || getFirstResult()>0 || (this.descriptor != null && this.descriptor.hasInheritance() && this.descriptor.getInheritancePolicy().shouldOuterJoinSubclasses()) );