/** * INTERNAL: */ public AbstractSession getSession() { return getBuilder().getSession(); }
/** * INTERNAL: * Retrun an expression that updates the write lock */ public Expression getWriteLockUpdateExpression(ExpressionBuilder builder) { return builder.value(getInitialWriteValue(builder.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()); } } return descriptor; }
/** * Return the row with primary keys and their values from the given expression. */ public Vector extractPrimaryKeyFromExpression(boolean requiresExactMatch, Expression expression, AbstractRecord translationRow, AbstractSession session) { AbstractRecord primaryKeyRow = createRecord(getPrimaryKeyMappings().size()); //put the curent session onthe expression builder for use later store current session incase //it is required at a later stage AbstractSession oldSession = expression.getBuilder().getSession(); expression.getBuilder().setSession(session.getRootSession(null)); // Get all the field & values from expression. boolean isValid = expression.extractPrimaryKeyValues(requiresExactMatch, getDescriptor(), primaryKeyRow, translationRow); if (requiresExactMatch && (!isValid)) { return null; } // Check that the sizes match. if (primaryKeyRow.size() != getDescriptor().getPrimaryKeyFields().size()) { return null; } return extractPrimaryKeyFromRow(primaryKeyRow, session); }
/** * Return the row with primary keys and their values from the given expression. */ public AbstractRecord extractPrimaryKeyRowFromExpression(Expression expression, AbstractRecord translationRow, AbstractSession session) { AbstractRecord primaryKeyRow = createRecord(getPrimaryKeyMappings().size()); //put the curent session onthe expression builder for use later store current session incase //it is required at a later stage AbstractSession oldSession = expression.getBuilder().getSession(); expression.getBuilder().setSession(session.getRootSession(null)); // Get all the field & values from expression boolean isValid = expression.extractPrimaryKeyValues(true, getDescriptor(), primaryKeyRow, translationRow); expression.getBuilder().setSession(session.getRootSession(null)); if (!isValid) { return null; } // Check that the sizes match up if (primaryKeyRow.size() != getDescriptor().getPrimaryKeyFields().size()) { return null; } return primaryKeyRow; }
if ((selectionCriteria != null) && (selectionCriteriaClone.getBuilder().getSession() == null)) { selectionCriteriaClone = (Expression)selectionCriteria.clone(); selectionCriteriaClone.getBuilder().setSession(getSession().getRootSession(null));
if (isUsingOuterJoinForMultitableInheritance() && getSession().getPlatform().shouldPrintOuterJoinInWhereClause()) { Expression childrenCriteria = getDescriptor().getInheritancePolicy().getChildrenJoinExpression(); childrenCriteria = this.twist(childrenCriteria, this); if (isUsingOuterJoinForMultitableInheritance() && (!getSession().getPlatform().shouldPrintOuterJoinInWhereClause())) { normalizer.getStatement().getOuterJoinExpressions().addElement(null); normalizer.getStatement().getOuterJoinedMappingCriteria().addElement(null);
if ((selectionCriteria != null) && (selectionCriteriaClone.getBuilder().getSession() == null)) { selectionCriteriaClone = (Expression)selectionCriteria.clone(); selectionCriteriaClone.getBuilder().setSession(getSession().getRootSession(null));