/** * 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()); } }
this.batchFetchPolicy.setAttributes(new ArrayList(batchReadAttributeExpressions.size())); if (!initialized) { this.batchFetchPolicy.setMappingQueries(new HashMap(batchReadAttributeExpressions.size()));
this.batchFetchPolicy.setAttributes(new ArrayList(batchReadAttributeExpressions.size())); if (!initialized) { this.batchFetchPolicy.setMappingQueries(new HashMap(batchReadAttributeExpressions.size()));