/** * INTERNAL: Find the alias for a given table. Handle the special case where we are bogus * and it should be aliased against our derived tables instead. */ public DatabaseTable aliasForTable(DatabaseTable table) { if (hasViewTable()) { return getAliasedViewTable(); } if (doesNotRepresentAnObjectInTheQuery()) { for (Enumeration e = derivedTables.elements(); e.hasMoreElements();) { TableExpression t = (TableExpression)e.nextElement(); DatabaseTable result = t.aliasForTable(table); if (result != null) { return result; } } } else { return super.aliasForTable(table); } return null;// No alias found in the derived tables }
/** * INTERNAL: Find the alias for a given table. Handle the special case where we are bogus * and it should be aliased against our derived tables instead. */ public DatabaseTable aliasForTable(DatabaseTable table) { if (hasViewTable()) { return getAliasedViewTable(); } if (doesNotRepresentAnObjectInTheQuery()) { for (Expression expression : this.derivedTables) { DatabaseTable result = expression.aliasForTable(table); if (result != null) { return result; } } } else { return super.aliasForTable(table); } return null; // No alias found in the derived tables }
/** * INTERNAL: Find the alias for a given table. Handle the special case where we are bogus * and it should be aliased against our derived tables instead. */ public DatabaseTable aliasForTable(DatabaseTable table) { if (hasViewTable()) { return getAliasedViewTable(); } if (doesNotRepresentAnObjectInTheQuery()) { for (Expression expression : this.derivedTables) { DatabaseTable result = expression.aliasForTable(table); if (result != null) { return result; } } } else { return super.aliasForTable(table); } return null; // No alias found in the derived tables }
if (hasViewTable()) { DatabaseTable aliased = (DatabaseTable)viewTable.clone(); String alias = "t" + initialValue;
if (hasViewTable()) { DatabaseTable aliased = viewTable.clone(); String alias = "t" + initialValue;
if (hasViewTable()) { DatabaseTable aliased = viewTable.clone(); String alias = "t" + initialValue;
/** * Calculate the source table for based on the various QueryKeyExpression * usages (join query keys, custom defined query keys, or query keys for * mappings). * * Called from {@link SQLSelectStatement#appendFromClauseForOuterJoin}. * * @return DatabaseTable */ public DatabaseTable getSourceTable() { if (getBaseExpression().isExpressionBuilder() && getBuilder().hasViewTable()) { return getBuilder().getViewTable(); } if (getMapping() != null) { // Grab the source table from the mapping not just the first table // from the descriptor. In an joined inheritance hierarchy, the // fk used in the outer join may be from a subclasses's table. if (getMapping().isObjectReferenceMapping() && ((ObjectReferenceMapping) getMapping()).isForeignKeyRelationship()) { return getMapping().getFields().firstElement().getTable(); } else { return ((ObjectExpression)this.baseExpression).getDescriptor().getTables().firstElement(); } } else { return ((ForeignReferenceQueryKey)getQueryKeyOrNull()).getSourceTable(); } }
/** * Calculate the source table for based on the various QueryKeyExpression * usages (join query keys, custom defined query keys, or query keys for * mappings). * * Called from {@link SQLSelectStatement#appendFromClauseForOuterJoin}. * * @return DatabaseTable */ public DatabaseTable getSourceTable() { if (getBaseExpression().isExpressionBuilder() && getBuilder().hasViewTable()) { return getBuilder().getViewTable(); } if (getMapping() != null) { // Grab the source table from the mapping not just the first table // from the descriptor. In an joined inheritance hierarchy, the // fk used in the outer join may be from a subclasses's table. if (getMapping().isObjectReferenceMapping() && ((ObjectReferenceMapping) getMapping()).isForeignKeyRelationship()) { return getMapping().getFields().firstElement().getTable(); } else { return ((ObjectExpression)this.baseExpression).getDescriptor().getTables().firstElement(); } } else { return ((ForeignReferenceQueryKey)getQueryKeyOrNull()).getSourceTable(); } }