/** * INTERNAL: */ public AbstractSession getSession() { return getBuilder().getSession(); }
/** * INTERNAL: */ public AbstractSession getSession() { return getBuilder().getSession(); }
/** * INTERNAL: */ public AbstractSession getSession() { return getBuilder().getSession(); }
/** * INTERNAL: * Only usable after the session and class have been set. Return the * descriptor for the class this node represents. */ public ClassDescriptor getDescriptor() { if (descriptor == null) { if (getQueryClass() == null) { return null; } else { if (getSession() == null) { throw QueryException.noExpressionBuilderFound(this); } descriptor = getSession().getDescriptor(getQueryClass()); descriptor = convertToCastDescriptor(descriptor, getSession()); } } return descriptor; }
/** * INTERNAL: * Only usable after the session and class have been set. Return the * descriptor for the class this node represents. */ public ClassDescriptor getDescriptor() { if (descriptor == null) { if (getQueryClass() == null) { return null; } else { if (getSession() == null) { throw QueryException.noExpressionBuilderFound(this); } descriptor = getSession().getDescriptor(getQueryClass()); descriptor = convertToCastDescriptor(descriptor, getSession()); } } return descriptor; }
/** * INTERNAL: * Only usable after the session and class have been set. Return the * descriptor for the class this node represents. */ public ClassDescriptor getDescriptor() { if (descriptor == null) { if (getQueryClass() == null) { return null; } else { if (getSession() == null) { throw QueryException.noExpressionBuilderFound(this); } descriptor = getSession().getDescriptor(getQueryClass()); } } return descriptor; }
/** * If there is no where clause, alias the tables from the tables list directly. Assume there's * no ambiguity */ public void computeTablesFromTables() { Map<DatabaseTable, DatabaseTable> allTables = new Hashtable(); AsOfClause asOfClause = null; if (getBuilder().hasAsOfClause() && !getBuilder().getSession().getProject().hasGenericHistorySupport()) { asOfClause = getBuilder().getAsOfClause(); } for (int index = 0; index < getTables().size(); index++) { DatabaseTable next = getTables().get(index); // Aliases in allTables must now be decorated database tables. DatabaseTable alias = new DecoratedDatabaseTable("t" + (index), asOfClause); allTables.put(alias, next); } setTableAliases(allTables); }
/** * If there is no where clause, alias the tables from the tables list directly. Assume there's * no ambiguity */ public void computeTablesFromTables() { Hashtable allTables = new Hashtable(); AsOfClause asOfClause = null; if (getBuilder().hasAsOfClause() && !getBuilder().getSession().getProject().hasGenericHistorySupport()) { asOfClause = getBuilder().getAsOfClause(); } for (int index = 0; index < getTables().size(); index++) { DatabaseTable next = (DatabaseTable)getTables().elementAt(index); // Aliases in allTables must now be decorated database tables. DatabaseTable alias = new DecoratedDatabaseTable("t" + (index), asOfClause); allTables.put(alias, next); } setTableAliases(allTables); }
/** * If there is no where clause, alias the tables from the tables list directly. Assume there's * no ambiguity */ public void computeTablesFromTables() { Map<DatabaseTable, DatabaseTable> allTables = new Hashtable(); AsOfClause asOfClause = null; if (getBuilder().hasAsOfClause() && !getBuilder().getSession().getProject().hasGenericHistorySupport()) { asOfClause = getBuilder().getAsOfClause(); } for (int index = 0; index < getTables().size(); index++) { DatabaseTable next = getTables().get(index); // Aliases in allTables must now be decorated database tables. DatabaseTable alias = new DecoratedDatabaseTable("t" + (index), asOfClause); allTables.put(alias, next); } setTableAliases(allTables); }
/** * INTERNAL: * If the alias is for a query key item, then return its descriptor. * If it is for a function, then it has no descriptor. */ @Override public ClassDescriptor getContainingDescriptor() { AbstractSession session = getBuilder().getSession(); if (this.containingDescriptor == null) { Expression expression = getItem().getAttributeExpression(); if (expression.isQueryKeyExpression()) { // Need to ensure expression has a session before getting its descriptor. if (expression.getBuilder().getSession() == null) { expression.getBuilder().setSession(session); } this.containingDescriptor = ((QueryKeyExpression)expression).getContainingDescriptor(); return this.containingDescriptor; } return null; } return containingDescriptor; }
/** * INTERNAL: * If the alias is for a query key item, then return its descriptor. * If it is for a function, then it has no descriptor. */ @Override public ClassDescriptor getContainingDescriptor() { AbstractSession session = getBuilder().getSession(); if (this.containingDescriptor == null) { Expression expression = getItem().getAttributeExpression(); if (expression.isQueryKeyExpression()) { // Need to ensure expression has a session before getting its descriptor. if (expression.getBuilder().getSession() == null) { expression.getBuilder().setSession(session); } this.containingDescriptor = ((QueryKeyExpression)expression).getContainingDescriptor(); return this.containingDescriptor; } return null; } return containingDescriptor; }
/** * INTERNAL: * Compute the cache batched attributes. * Used to recompute batched attributes for nested aggregate queries. */ public void computeBatchReadAttributes() { List<Expression> batchReadAttributeExpressions = getBatchReadAttributeExpressions(); this.batchFetchPolicy.setAttributes(new ArrayList(batchReadAttributeExpressions.size())); int size = batchReadAttributeExpressions.size(); for (int index = 0; index < size; index++) { ObjectExpression objectExpression = (ObjectExpression)batchReadAttributeExpressions.get(index); // Expression may not have been initialized. ExpressionBuilder builder = objectExpression.getBuilder(); if (builder.getSession() == null) { builder.setSession(getSession().getRootSession(null)); } if (builder.getQueryClass() == null) { builder.setQueryClass(getReferenceClass()); } // PERF: Cache join attribute names. ObjectExpression baseExpression = objectExpression; while (!baseExpression.getBaseExpression().isExpressionBuilder()) { baseExpression = (ObjectExpression)baseExpression.getBaseExpression(); } this.batchFetchPolicy.getAttributes().add(baseExpression.getName()); } }
/** * INTERNAL: * Compute the cache batched attributes. * Used to recompute batched attributes for nested aggregate queries. */ public void computeBatchReadAttributes() { List<Expression> batchReadAttributeExpressions = getBatchReadAttributeExpressions(); this.batchFetchPolicy.setAttributes(new ArrayList(batchReadAttributeExpressions.size())); int size = batchReadAttributeExpressions.size(); for (int index = 0; index < size; index++) { ObjectExpression objectExpression = (ObjectExpression)batchReadAttributeExpressions.get(index); // Expression may not have been initialized. ExpressionBuilder builder = objectExpression.getBuilder(); if (builder.getSession() == null) { builder.setSession(getSession().getRootSession(null)); } if (builder.getQueryClass() == null) { builder.setQueryClass(getReferenceClass()); } // PERF: Cache join attribute names. ObjectExpression baseExpression = objectExpression; while (!baseExpression.getBaseExpression().isExpressionBuilder()) { baseExpression = (ObjectExpression)baseExpression.getBaseExpression(); } this.batchFetchPolicy.getAttributes().add(baseExpression.getName()); } }
/** * INTERNAL: * Alias a particular table within this node */ @Override protected void assignAlias(String name, DatabaseTable table) { if (!getBuilder().getSession().getProject().hasGenericHistorySupport()) { assignAlias(new DecoratedDatabaseTable(name, getAsOfClause()), table); } else { assignAlias(new DatabaseTable(name), table); } }
/** * INTERNAL: * Alias a particular table within this node */ @Override protected void assignAlias(String name, DatabaseTable table) { if (!getBuilder().getSession().getProject().hasGenericHistorySupport()) { assignAlias(new DecoratedDatabaseTable(name, getAsOfClause()), table); } else { assignAlias(new DatabaseTable(name), table); } }
/** * INTERNAL: * Alias a particular table within this node */ protected void assignAlias(String name, DatabaseTable table) { if (!getBuilder().getSession().getProject().hasGenericHistorySupport()) { assignAlias(new DecoratedDatabaseTable(name, getAsOfClause()), table); } else { assignAlias(new DatabaseTable(name), table); } }
if ((this.secondChild.getBuilder().getSession() == null) || (this.firstChild.getBuilder().getSession() == null)) {
if (builder.getSession() == null) { builder.setSession(getSession().getRootSession(null));
if (builder.getSession() == null) { builder.setSession(getSession().getRootSession(null));
if (this.firstChild.getBuilder().getSession() == null) { this.firstChild.getBuilder().setSession(session.getRootSession(null)); if (this.secondChild.getBuilder().getSession() == null) { this.secondChild.getBuilder().setSession(session.getRootSession(null));