/** * PUBLIC: * Intersect the query results with the other query. */ public void intersect(ReportQuery query) { addUnionExpression(getExpressionBuilder().intersect(query)); }
/** * PUBLIC: * Except the query results with the other query. */ public void except(ReportQuery query) { addUnionExpression(getExpressionBuilder().except(query)); }
/** * PUBLIC: * Union the query results with the other query. */ public void union(ReportQuery query) { addUnionExpression(getExpressionBuilder().union(query)); }
/** * INTERNAL: * Return join manager responsible for managing all aspects of joining for the query. * Queries without joining should not have a joinedAttributeManager. */ public JoinedAttributeManager getJoinedAttributeManager() { if (this.joinedAttributeManager == null) { this.joinedAttributeManager = new JoinedAttributeManager(getDescriptor(), getExpressionBuilder(), this); } return this.joinedAttributeManager; }
/** * PUBLIC: * Union the query results with the other query. */ public void union(ReportQuery query) { addUnionExpression(getExpressionBuilder().union(query)); }
/** * PUBLIC: * Intersect the query results with the other query. */ public void intersect(ReportQuery query) { addUnionExpression(getExpressionBuilder().intersect(query)); }
/** * PUBLIC: * Except the query results with the other query. */ public void except(ReportQuery query) { addUnionExpression(getExpressionBuilder().except(query)); }
public void setAttributeValueInObject(Object object, Object value) { if (!(object instanceof ObjectLevelReadQuery)) { return; } ObjectLevelReadQuery query = (ObjectLevelReadQuery)object; Expression expression = (Expression)value; if (expression != null) { expression = expression.rebuildOn(query.getExpressionBuilder()); } query.setSelectionCriteria(expression); } });
/** * INTERNAL: * Return join manager responsible for managing all aspects of joining for the query. * Queries without joining should not have a joinedAttributeManager. */ public JoinedAttributeManager getJoinedAttributeManager() { if (this.joinedAttributeManager == null) { this.joinedAttributeManager = new JoinedAttributeManager(getDescriptor(), getExpressionBuilder(), this); } return this.joinedAttributeManager; }
/** * INTERNAL: * Return join manager responsible for managing all aspects of joining for the query. * Queries without joining should not have a joinedAttributeManager. */ public JoinedAttributeManager getJoinedAttributeManager() { if (this.joinedAttributeManager == null) { this.joinedAttributeManager = new JoinedAttributeManager(getDescriptor(), getExpressionBuilder(), this); } return this.joinedAttributeManager; }
public void setAttributeValueInObject(Object object, Object value) { if (!(object instanceof ObjectLevelReadQuery)) { return; } ObjectLevelReadQuery query = (ObjectLevelReadQuery)object; Expression expression = (Expression)value; if (expression != null) { expression = expression.rebuildOn(query.getExpressionBuilder()); } query.setSelectionCriteria(expression); } });
@Override public void setAttributeValueInObject(Object object, Object value) { if (!(object instanceof ObjectLevelReadQuery)) { return; } ObjectLevelReadQuery query = (ObjectLevelReadQuery)object; Expression expression = (Expression)value; if (expression != null) { expression = expression.rebuildOn(query.getExpressionBuilder()); } query.setSelectionCriteria(expression); } });
/** * PUBLIC: * Order the query results by the object's attribute or query key name. */ public void addDescendingOrdering(String queryKeyName) { addOrdering(getExpressionBuilder().get(queryKeyName).descending()); }
/** * PUBLIC: * Order the query results by the object's attribute or query key name. */ public void addDescendingOrdering(String queryKeyName) { addOrdering(getExpressionBuilder().get(queryKeyName).descending()); }
/** * PUBLIC: * Order the query results by the object's attribute or query key name. */ public void addDescendingOrdering(String queryKeyName) { addOrdering(getExpressionBuilder().get(queryKeyName).descending()); }
/** * INTERNAL: * Called only if both * shouldExtendPessimisticLockScope and shouldExtendPessimisticLockScopeInSourceQuery are true. * Adds fields to be locked to the where clause of the source query. * Note that the sourceQuery must be ObjectLevelReadQuery so that it has ExpressionBuilder. * * This method must be implemented in subclasses that allow * setting shouldExtendPessimisticLockScopeInSourceQuery to true. */ public void extendPessimisticLockScopeInSourceQuery(ObjectLevelReadQuery sourceQuery) { Expression exp = sourceQuery.getSelectionCriteria(); exp = this.mechanism.joinRelationTableField(exp, sourceQuery.getExpressionBuilder()); sourceQuery.setSelectionCriteria(exp); }
/** * INTERNAL: * Return relation table locking clause. */ public void setRelationTableLockingClause(ObjectLevelReadQuery targetQuery, ObjectBuildingQuery sourceQuery) { ForUpdateOfClause lockingClause = new ForUpdateOfClause(); lockingClause.setLockMode(sourceQuery.getLockMode()); FieldExpression exp = (FieldExpression)targetQuery.getExpressionBuilder().getTable(this.relationTable).getField(this.sourceRelationKeyFields.get(0)); lockingClause.addLockedExpression(exp); targetQuery.setLockingClause(lockingClause); // locking clause is not compatible with DISTINCT targetQuery.setShouldOuterJoinSubclasses(true); }
/** * INTERNAL: * Return relation table locking clause. */ public void setRelationTableLockingClause(ObjectLevelReadQuery targetQuery, ObjectBuildingQuery sourceQuery) { ForUpdateOfClause lockingClause = new ForUpdateOfClause(); lockingClause.setLockMode(sourceQuery.getLockMode()); FieldExpression exp = (FieldExpression)targetQuery.getExpressionBuilder().getTable(this.relationTable).getField(this.sourceRelationKeyFields.get(0)); lockingClause.addLockedExpression(exp); targetQuery.setLockingClause(lockingClause); // locking clause is not compatible with DISTINCT targetQuery.setShouldOuterJoinSubclasses(true); }
/** * INTERNAL: * Return relation table locking clause. */ public void setRelationTableLockingClause(ObjectLevelReadQuery targetQuery, ObjectBuildingQuery sourceQuery) { ForUpdateOfClause lockingClause = new ForUpdateOfClause(); lockingClause.setLockMode(sourceQuery.getLockMode()); FieldExpression exp = (FieldExpression)targetQuery.getExpressionBuilder().getTable(this.relationTable).getField(this.sourceRelationKeyFields.get(0)); lockingClause.addLockedExpression(exp); targetQuery.setLockingClause(lockingClause); // locking clause is not compatible with DISTINCT targetQuery.setShouldOuterJoinSubclasses(true); }
private Expression addNonFetchJoinedAttribute(org.eclipse.persistence.jpa.jpql.parser.Expression expression, IdentificationVariable identificationVariable) { String variableName = identificationVariable.getVariableName(); // Always add the expression, as it may not be defined elsewhere, // unless it has already been defined as the builder. Expression queryExpression = queryContext.getQueryExpression(variableName); if (queryExpression == null) { queryExpression = queryContext.buildExpression(expression); queryContext.addQueryExpression(variableName, queryExpression); } ObjectLevelReadQuery query = (ObjectLevelReadQuery) queryContext.getDatabaseQuery(); if (query.getExpressionBuilder() != queryExpression) { query.addNonFetchJoinedAttribute(queryExpression); } return queryExpression; }