/** * INTERNAL: * The subquery must be normalized with the knowledge of the outer statement for outer references and correct aliasing. * For CR#4223 it will now be normalized after the outer statement is, rather than * somewhere in the middle of the outer statement's normalize. */ public Expression normalize(ExpressionNormalizer normalizer) { //has no effect but validateNode is here for consistency validateNode(); // Defer normalization of this expression until later. normalizer.addSubSelectExpression(this); normalizer.getStatement().setRequiresAliases(true); return this; }
/** * INTERNAL: * The subquery must be normalized with the knowledge of the outer statement for outer references and correct aliasing. * For CR#4223 it will now be normalized after the outer statement is, rather than * somewhere in the middle of the outer statement's normalize. */ @Override public Expression normalize(ExpressionNormalizer normalizer) { if (this.hasBeenNormalized) { return this; } //has no effect but validateNode is here for consistency validateNode(); // Defer normalization of this expression until later. normalizer.addSubSelectExpression(this); normalizer.getStatement().setRequiresAliases(true); return this; }
/** * INTERNAL: * The subquery must be normalized with the knowledge of the outer statement for outer references and correct aliasing. * For CR#4223 it will now be normalized after the outer statement is, rather than * somewhere in the middle of the outer statement's normalize. */ @Override public Expression normalize(ExpressionNormalizer normalizer) { if (this.hasBeenNormalized) { return this; } //has no effect but validateNode is here for consistency validateNode(); // Defer normalization of this expression until later. normalizer.addSubSelectExpression(this); normalizer.getStatement().setRequiresAliases(true); return this; }
/** * INTERNAL: * Normalize an expression mapping all of the descriptor's tables to the view. * This is used to allow a descriptor to read from a view, but write to tables. * This is used in the multiple table and subclasses read so all of the descriptor's * possible tables must be mapped to the view. */ public void normalizeForView(AbstractSession theSession, ClassDescriptor theDescriptor, Map clonedExpressions) { ExpressionBuilder builder; // bug 3878553 - alias all view selects. setRequiresAliases(true); if (getWhereClause() != null) { builder = getWhereClause().getBuilder(); } else { builder = new ExpressionBuilder(); setBuilder(builder); } builder.setViewTable(getTables().get(0)); normalize(theSession, theDescriptor, clonedExpressions); }
/** * INTERNAL: * Normalize an expression mapping all of the descriptor's tables to the view. * This is used to allow a descriptor to read from a view, but write to tables. * This is used in the multiple table and subclasses read so all of the descriptor's * possible tables must be mapped to the view. */ public void normalizeForView(AbstractSession theSession, ClassDescriptor theDescriptor, Map clonedExpressions) { ExpressionBuilder builder; // bug 3878553 - alias all view selects. setRequiresAliases(true); if (getWhereClause() != null) { builder = getWhereClause().getBuilder(); } else { builder = new ExpressionBuilder(); setBuilder(builder); } builder.setViewTable(getTables().get(0)); normalize(theSession, theDescriptor, clonedExpressions); }
/** * INTERNAL: * Normalize an expression mapping all of the descriptor's tables to the view. * This is used to allow a descriptor to read from a view, but write to tables. * This is used in the multiple table and subclasses read so all of the descriptor's * possible tables must be mapped to the view. */ public void normalizeForView(AbstractSession theSession, ClassDescriptor theDescriptor, Map clonedExpressions) { ExpressionBuilder builder; // bug 3878553 - alias all view selects. setRequiresAliases(true); if (getWhereClause() != null) { builder = getWhereClause().getBuilder(); } else { builder = new ExpressionBuilder(); setBuilder(builder); } builder.setViewTable((DatabaseTable)getTables().firstElement()); normalize(theSession, theDescriptor, clonedExpressions); }
/** * INTERNAL: * Get the ref for the object. * This is required for use by Refs, there might be a better way to do it when objID are supported. * (i.e. getting it from the object or identity map). */ public Ref getRef(Object object, AbstractSession session) { SQLSelectStatement statement = new SQLSelectStatement(); statement.addTable(getTables().firstElement());// Assumed only one for obj-rel descriptors. statement.getFields().addElement(new org.eclipse.persistence.expressions.ExpressionBuilder().ref()); statement.setWhereClause(getObjectBuilder().buildPrimaryKeyExpressionFromObject(object, session)); statement.setRequiresAliases(true); statement.normalize(session, this); ValueReadQuery valueQuery = new ValueReadQuery(); valueQuery.setSQLStatement(statement); valueQuery.checkPrepare(session, new DatabaseRecord(), true); // Must return unwrapped Ref on WLS. valueQuery.getCall().setIsNativeConnectionRequired(true); Ref ref = (Ref)session.executeQuery(valueQuery); return ref; }
/** * INTERNAL: * Get the ref for the object. * This is required for use by Refs, there might be a better way to do it when objID are supported. * (i.e. getting it from the object or identity map). */ public Ref getRef(Object object, AbstractSession session) { SQLSelectStatement statement = new SQLSelectStatement(); statement.addTable(getTables().firstElement());// Assumed only one for obj-rel descriptors. statement.getFields().addElement(new org.eclipse.persistence.expressions.ExpressionBuilder().ref()); statement.setWhereClause(getObjectBuilder().buildPrimaryKeyExpressionFromObject(object, session)); statement.setRequiresAliases(true); statement.normalize(session, this); ValueReadQuery valueQuery = new ValueReadQuery(); valueQuery.setSQLStatement(statement); valueQuery.checkPrepare(session, new DatabaseRecord(), true); // Must return unwrapped Ref on WLS. valueQuery.getCall().setIsNativeConnectionRequired(true); Ref ref = (Ref)session.executeQuery(valueQuery); return ref; }
/** * INTERNAL: * Get the ref for the object. * This is required for use by Refs, there might be a better way to do it when objID are supported. * (i.e. getting it from the object or identity map). */ public Ref getRef(Object object, AbstractSession session) { SQLSelectStatement statement = new SQLSelectStatement(); statement.addTable(getTables().firstElement());// Assumed only one for obj-rel descriptors. statement.getFields().addElement(new org.eclipse.persistence.expressions.ExpressionBuilder().ref()); statement.setWhereClause(getObjectBuilder().buildPrimaryKeyExpressionFromObject(object, session)); statement.setRequiresAliases(true); statement.normalize(session, this); ValueReadQuery valueQuery = new ValueReadQuery(); valueQuery.setSQLStatement(statement); valueQuery.prepareCall(session, new DatabaseRecord()); // Must return unwrapped Ref on WLS. valueQuery.getCall().setIsNativeConnectionRequired(true); Ref ref = (Ref)session.executeQuery(valueQuery); return ref; }
/** * INTERNAL: * Normalize the expression into a printable structure. */ public Expression normalize(ExpressionNormalizer normalizer) { Expression expression = super.normalize(normalizer); // to support custom types, print expressions derived from field expressions, table expressions and direct query keys with their aliases if (getBaseExpression() != null && getBaseExpression().isFieldExpression() || getBaseExpression().isTableExpression() || (getBaseExpression().isQueryKeyExpression() && ((QueryKeyExpression)getBaseExpression()).isAttribute())){ getBuilder().getStatement().setRequiresAliases(true); } return expression; }
/** * INTERNAL: * Normalize the expression into a printable structure. */ public Expression normalize(ExpressionNormalizer normalizer) { if (this.hasBeenNormalized) { return this; } Expression expression = super.normalize(normalizer); // to support custom types, print expressions derived from field expressions, table expressions and direct query keys with their aliases if (getBaseExpression() != null && getBaseExpression().isFieldExpression() || getBaseExpression().isTableExpression() || (getBaseExpression().isQueryKeyExpression() && ((QueryKeyExpression)getBaseExpression()).isAttribute())){ getBuilder().getStatement().setRequiresAliases(true); } return expression; }
/** * INTERNAL: * Normalize the expression into a printable structure. */ public Expression normalize(ExpressionNormalizer normalizer) { if (this.hasBeenNormalized) { return this; } Expression expression = super.normalize(normalizer); // to support custom types, print expressions derived from field expressions, table expressions and direct query keys with their aliases if (getBaseExpression() != null && getBaseExpression().isFieldExpression() || getBaseExpression().isTableExpression() || (getBaseExpression().isQueryKeyExpression() && ((QueryKeyExpression)getBaseExpression()).isAttribute())){ getBuilder().getStatement().setRequiresAliases(true); } return expression; }
normalizer.getStatement().setRequiresAliases(true); normalizer.getStatement().setRequiresAliases(true); return this;
normalizer.getStatement().setRequiresAliases(true); statement.setRequiresAliases(true); statement.setParentStatement(normalizer.getStatement()); statement.normalize(normalizer.getSession(), getSubQuery().getDescriptor(), clonedExpressions);
normalizer.getStatement().setRequiresAliases(true); statement.setRequiresAliases(true); statement.setParentStatement(normalizer.getStatement()); statement.normalize(normalizer.getSession(), getSubQuery().getDescriptor(), clonedExpressions);
statement.setRequiresAliases(true); statement.setParentStatement(normalizer.getStatement()); statement.normalize(normalizer.getSession(), getSubQuery().getDescriptor(), clonedExpressions);
SQLSelectStatement statement = normalizer.getStatement(); if ((mapping != null) && mapping.isDirectToXMLTypeMapping()) { statement.setRequiresAliases(true); statement.setRequiresAliases(true); return this;
SQLSelectStatement statement = normalizer.getStatement(); if ((mapping != null) && mapping.isDirectToXMLTypeMapping()) { statement.setRequiresAliases(true); statement.setRequiresAliases(true); return this;