/** * INTERNAL: * Append the branch with all subclasses expression to the statement. */ public void appendWithAllSubclassesExpression(SQLSelectStatement selectStatement) { if (getWithAllSubclassesExpression() != null) { // For Flashback: Must always rebuild with simple expression on right. if (selectStatement.getWhereClause() == null) { selectStatement.setWhereClause((Expression)getWithAllSubclassesExpression().clone()); } else { selectStatement.setWhereClause(selectStatement.getWhereClause().and(getWithAllSubclassesExpression())); } } }
/** * INTERNAL: * Append the branch with all subclasses expression to the statement. */ public void appendWithAllSubclassesExpression(SQLSelectStatement selectStatement) { if (getWithAllSubclassesExpression() != null) { // For Flashback: Must always rebuild with simple expression on right. if (selectStatement.getWhereClause() == null) { selectStatement.setWhereClause((Expression)getWithAllSubclassesExpression().clone()); } else { selectStatement.setWhereClause(selectStatement.getWhereClause().and(getWithAllSubclassesExpression())); } } }
/** * INTERNAL: * Append the branch with all subclasses expression to the statement. */ public void appendWithAllSubclassesExpression(SQLSelectStatement selectStatement) { if (getWithAllSubclassesExpression() != null) { // For Flashback: Must always rebuild with simple expression on right. if (selectStatement.getWhereClause() == null) { selectStatement.setWhereClause((Expression)getWithAllSubclassesExpression().clone()); } else { selectStatement.setWhereClause(selectStatement.getWhereClause().and(getWithAllSubclassesExpression())); } } }
/** * INTERNAL: * Initialize the expression to use for queries to the class and its subclasses. */ protected void initializeWithAllSubclassesExpression() throws DescriptorException { if (getWithAllSubclassesExpression() == null) { if (hasClassExtractor()) { return; } if (isChildDescriptor() && shouldReadSubclasses()) { setWithAllSubclassesExpression(new ExpressionBuilder().getField(getClassIndicatorField()).in(getAllChildClassIndicators())); } } }
/** * INTERNAL: * Initialize the expression to use for queries to the class and its subclasses. */ protected void initializeWithAllSubclassesExpression() throws DescriptorException { if (getWithAllSubclassesExpression() == null) { if (hasClassExtractor()) { return; } if (isChildDescriptor() && shouldReadSubclasses()) { setWithAllSubclassesExpression(new ExpressionBuilder().getField(getClassIndicatorField()).in(getAllChildClassIndicators())); } } }
/** * INTERNAL: * Initialize the expression to use for queries to the class and its subclasses. */ protected void initializeWithAllSubclassesExpression() throws DescriptorException { if (getWithAllSubclassesExpression() == null) { if (hasClassExtractor()) { return; } if (isChildDescriptor() && shouldReadSubclasses()) { setWithAllSubclassesExpression(new ExpressionBuilder().getField(getClassIndicatorField()).in(getAllChildClassIndicators())); } } }
/** * INTERNAL: * Build a select statement for all subclasses on the view using the same * selection criteria as the query. */ public SQLSelectStatement buildViewSelectStatement(ObjectLevelReadQuery query) { // 2612538 - the default size of Map (32) is appropriate Map clonedExpressions = new IdentityHashMap(); ExpressionQueryMechanism mechanism = (ExpressionQueryMechanism)query.getQueryMechanism(); // CR#3166555 - Have the mechanism build the statement to avoid duplicating code and ensure that lock-mode, hints, hierarchical, etc. are set. SQLSelectStatement selectStatement = mechanism.buildBaseSelectStatement(false, clonedExpressions); selectStatement.setTables(org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(1)); selectStatement.addTable(getReadAllSubclassesView()); // Case, normal read for branch inheritance class that reads subclasses all in its own table(s). if (getWithAllSubclassesExpression() != null) { Expression branchIndicator = (Expression)getWithAllSubclassesExpression().clone(); if (branchIndicator != null) { selectStatement.setWhereClause(branchIndicator.and(selectStatement.getWhereClause())); } } selectStatement.setFields(mechanism.getSelectionFields(selectStatement, true)); selectStatement.normalizeForView(query.getSession(), getDescriptor(), clonedExpressions); // Allow for joining indexes to be computed to ensure distinct rows if (query.hasJoining()) { query.getJoinedAttributeManager().computeJoiningMappingIndexes(false, query.getSession(), 0); } return selectStatement; }
/** * INTERNAL: * Build a select statement for all subclasses on the view using the same * selection criteria as the query. */ public SQLSelectStatement buildViewSelectStatement(ObjectLevelReadQuery query) { // 2612538 - the default size of Map (32) is appropriate Map clonedExpressions = new IdentityHashMap(); ExpressionQueryMechanism mechanism = (ExpressionQueryMechanism)query.getQueryMechanism(); // CR#3166555 - Have the mechanism build the statement to avoid duplicating code and ensure that lock-mode, hints, hierarchical, etc. are set. SQLSelectStatement selectStatement = mechanism.buildBaseSelectStatement(false, clonedExpressions); selectStatement.setTables(org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(1)); selectStatement.addTable(getReadAllSubclassesView()); // Case, normal read for branch inheritance class that reads subclasses all in its own table(s). if (getWithAllSubclassesExpression() != null) { Expression branchIndicator = (Expression)getWithAllSubclassesExpression().clone(); if (branchIndicator != null) { selectStatement.setWhereClause(branchIndicator.and(selectStatement.getWhereClause())); } } selectStatement.setFields(mechanism.getSelectionFields(selectStatement, true)); selectStatement.normalizeForView(query.getSession(), getDescriptor(), clonedExpressions); // Allow for joining indexes to be computed to ensure distinct rows if (query.hasJoining()) { query.getJoinedAttributeManager().computeJoiningMappingIndexes(false, query.getSession(), 0); } return selectStatement; }
/** * INTERNAL: * Build a select statement for all subclasses on the view using the same * selection criteria as the query. */ public SQLSelectStatement buildViewSelectStatement(ObjectLevelReadQuery query) { // 2612538 - the default size of Map (32) is appropriate Map clonedExpressions = new IdentityHashMap(); ExpressionQueryMechanism mechanism = (ExpressionQueryMechanism)query.getQueryMechanism(); // CR#3166555 - Have the mechanism build the statement to avoid duplicating code and ensure that lock-mode, hints, hierarchical, etc. are set. SQLSelectStatement selectStatement = mechanism.buildBaseSelectStatement(false, clonedExpressions); selectStatement.setTables(org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(1)); selectStatement.addTable(getReadAllSubclassesView()); // Case, normal read for branch inheritance class that reads subclasses all in its own table(s). if (getWithAllSubclassesExpression() != null) { Expression branchIndicator = (Expression)getWithAllSubclassesExpression().clone(); if (branchIndicator != null) { selectStatement.setWhereClause(branchIndicator.and(selectStatement.getWhereClause())); } } selectStatement.setFields(mechanism.getSelectionFields(selectStatement, true)); selectStatement.normalizeForView(query.getSession(), getDescriptor(), clonedExpressions); // Allow for joining indexes to be computed to ensure distinct rows if (query.hasJoining()) { query.getJoinedAttributeManager().computeJoiningMappingIndexes(false, query.getSession(), 0); } return selectStatement; }
public Expression getTypeClause() { if (typeExpression == null) { if (getDescriptor() !=null && isDowncast()) { InheritancePolicy ip = this.getDescriptor().getInheritancePolicy(); if (ip.isChildDescriptor()) {//or use the isDowncast flag. Don't need to do anything if its not a downcast //equivalent to typeExpressionBase.type().in(this.getDescriptor().getInheritancePolicy().getChildClasses()) typeExpression = ip.getWithAllSubclassesExpression(); if (typeExpression == null ) { typeExpression = typeExpressionBase.type().equal(this.getDescriptor().getJavaClass()); } else { typeExpression = this.typeExpressionBase.twist(typeExpression, typeExpressionBase); } } } else { typeExpression = this.getBuilder();//equivalent to an empty expression. } } return typeExpression; }
public Expression getTypeClause() { if (typeExpression == null) { if (getDescriptor() !=null && isDowncast()) { InheritancePolicy ip = this.getDescriptor().getInheritancePolicy(); if (ip.isChildDescriptor()) {//or use the isDowncast flag. Don't need to do anything if its not a downcast //equivalent to typeExpressionBase.type().in(this.getDescriptor().getInheritancePolicy().getChildClasses()) typeExpression = ip.getWithAllSubclassesExpression(); if (typeExpression == null ) { typeExpression = typeExpressionBase.type().equal(this.getDescriptor().getJavaClass()); } else { typeExpression = this.typeExpressionBase.twist(typeExpression, typeExpressionBase); } } } else { typeExpression = this.getBuilder();//equivalent to an empty expression. } } return typeExpression; }
if (descriptor.hasInheritance() && (descriptor.getInheritancePolicy().getWithAllSubclassesExpression() != null)) { Expression branchIndicator = descriptor.getInheritancePolicy().getWithAllSubclassesExpression(); if ((branchIndicator != null) && (selectStatement.getWhereClause() != null)) { selectStatement.setWhereClause(selectStatement.getWhereClause().and(branchIndicator));
if (descriptor.hasInheritance() && (descriptor.getInheritancePolicy().getWithAllSubclassesExpression() != null)) { Expression branchIndicator = descriptor.getInheritancePolicy().getWithAllSubclassesExpression(); if ((branchIndicator != null) && (selectStatement.getWhereClause() != null)) { selectStatement.setWhereClause(selectStatement.getWhereClause().and(branchIndicator));
indicatorExpression = policy.getWithAllSubclassesExpression(); } else { indicatorExpression = policy.getOnlyInstancesExpression();
inheritanceExpression = getDescriptor().getInheritancePolicy().getWithAllSubclassesExpression(); } else { inheritanceExpression = getDescriptor().getInheritancePolicy().getOnlyInstancesExpression();
indicatorExpression = policy.getWithAllSubclassesExpression(); } else { indicatorExpression = policy.getOnlyInstancesExpression();
inheritanceExpression = descriptor.getInheritancePolicy().getWithAllSubclassesExpression(); } else { inheritanceExpression = descriptor.getInheritancePolicy().getOnlyInstancesExpression();
inheritanceExpression = descriptor.getInheritancePolicy().getWithAllSubclassesExpression(); } else { inheritanceExpression = descriptor.getInheritancePolicy().getOnlyInstancesExpression();
if (getQuery().getDescriptor().hasInheritance() && (getQuery().getDescriptor().getInheritancePolicy().getWithAllSubclassesExpression() != null)) { Expression branchIndicator = getQuery().getDescriptor().getInheritancePolicy().getWithAllSubclassesExpression(); if ((branchIndicator != null) && (selectStatement.getWhereClause() != null)) { selectStatement.setWhereClause(selectStatement.getWhereClause().and(branchIndicator));