/** * INTERNAL: * Return if the represents an object comparison. */ protected boolean isObjectComparison() { if (getChildren().size() != 1) { return false; } int selector = getOperator().getSelector(); if ((selector != ExpressionOperator.IsNull) && (selector != ExpressionOperator.NotNull)) { return false; } Expression base = getBaseExpression(); return (base.isObjectExpression() && (!((ObjectExpression)base).isAttribute())); }
/** * INTERNAL: * Validate and prepare join expressions. */ public void prepareJoinExpressions(AbstractSession session) { // The prepareJoinExpression check for outer-joins to set this to true. setIsOuterJoinedAttributeQuery(false); for (int index = 0; index < getJoinedAttributeExpressions().size(); index++) { Expression expression = (Expression)getJoinedAttributeExpressions().get(index); if(expression.isObjectExpression()) { ((ObjectExpression)expression).setShouldUseOuterJoinForMultitableInheritance(true); } prepareJoinExpression(expression, session); } for (int index = 0; index < getJoinedMappingExpressions().size(); index++) { Expression expression = (Expression)getJoinedMappingExpressions().get(index); if(expression.isObjectExpression()) { ((ObjectExpression)expression).setShouldUseOuterJoinForMultitableInheritance(true); } prepareJoinExpression(expression, session); } computeJoiningMappingQueries(session); }
/** * INTERNAL: * Used for joining in conjunction with pessimistic locking * Iterate through a list of joined expressions and ensure expression is set on the locking * clause for each expression that represents a pessimisically locked descriptor. */ private void setupLockingClauseForJoinedExpressions(List joinedExpressions, AbstractSession session) { // Must iterate over all of the joined attributes, just check // if any of them have pessimistic locking defined on the descriptor. for (Iterator e = joinedExpressions.iterator(); e.hasNext();) { Expression expression = (Expression)e.next(); // Expression has not yet been validated. if (expression.isObjectExpression()) { ObjectExpression joinedAttribute = (ObjectExpression)expression; // Expression may not have been initialized. joinedAttribute.getBuilder().setSession(session.getRootSession(null)); if (joinedAttribute.getBuilder().getQueryClass() == null){ joinedAttribute.getBuilder().setQueryClass(descriptor.getJavaClass()); } ClassDescriptor nestedDescriptor = null;// joinedAttribute.getDescriptor(); // expression may not be valid, no descriptor, validation occurs later. if (nestedDescriptor == null) { return; } } } return; }
DatabaseField field = (DatabaseField)sourceFieldsEnum.next(); Expression join = base.getField(field); if (expression.isObjectExpression() && ((ObjectExpression)expression).shouldUseOuterJoin()){ join = join.equalOuterJoin(join); } else { DatabaseField targetField = (DatabaseField)targetFieldsEnum.next(); Expression join = null; if (expression.isObjectExpression() && ((ObjectExpression)expression).shouldUseOuterJoin()){ join = base.getField(sourceField).equalOuterJoin(argument.getField(targetField)); } else {
DatabaseField field = (DatabaseField)sourceFieldsEnum.next(); Expression join = null; if (expression.isObjectExpression() && ((ObjectExpression)expression).shouldUseOuterJoin()){ join = base.getField(field).equalOuterJoin(null); } else { DatabaseField field = (DatabaseField)sourceFieldsEnum.next(); Expression join = null; if (expression.isObjectExpression() && ((ObjectExpression)expression).shouldUseOuterJoin()){ join = base.getField(field).equalOuterJoin(keyEnum.nextElement()); } else {
/** * INTERNAL: * Return if the represents an object comparison. */ protected boolean isObjectComparison() { if ((!getFirstChild().isObjectExpression()) || ((ObjectExpression)getFirstChild()).isAttribute()) { return false; } DatabaseMapping mapping = ((ObjectExpression)getFirstChild()).getMapping(); if ((mapping != null) && (mapping.isDirectCollectionMapping())) { return false; } return getSecondChild().isObjectExpression() || (getSecondChild().isValueExpression() || (getSecondChild().isFunctionExpression() && ((FunctionExpression)getSecondChild()).getOperator().isAnyOrAll())); }
if ((getSelector() == Ref) || ((getSelector() == Deref) && (item.isObjectExpression()))) { DatabaseTable alias = ((ObjectExpression)item).aliasForTable((DatabaseTable)((ObjectExpression)item).getDescriptor().getTables().firstElement()); printer.printString(alias.getName());
Object targetObject = ((ConstantExpression)getSecondChild()).getValue(); foreignKeyJoin = first.getMapping().buildObjectJoinExpression(first, targetObject, getSession()); } else if (getSecondChild().isObjectExpression() || getSecondChild().isParameterExpression()) { foreignKeyJoin = first.getMapping().buildObjectJoinExpression(first, getSecondChild(), getSession()); } else { } else if (getSecondChild().isObjectExpression() || getSecondChild().isParameterExpression()) { foreignKeyJoin = first.twist(first.getDescriptor().getObjectBuilder().getPrimaryKeyExpression(), getSecondChild()); } else {
if (descriptor.isAggregateDescriptor() && ((ParameterExpression)getBaseExpression()).getLocalBase().isObjectExpression()) { descriptor = ((ObjectExpression)((ParameterExpression)getBaseExpression()).getLocalBase()).getDescriptor();