/** * INTERNAL: * Return true if the query uses default properties. * This is used to determine if this query is cacheable. * i.e. does not use any properties that may conflict with another query * with the same JPQL or selection criteria. */ @Override public boolean isDefaultPropertiesQuery() { return super.isDefaultPropertiesQuery() && (!this.isResultSetOptimizedQuery) && (this.isResultSetAccessOptimizedQuery == null || this.isResultSetAccessOptimizedQuery.equals(isResultSetAccessOptimizedQueryDefault)) && (this.shouldUseSerializedObjectPolicy == shouldUseSerializedObjectPolicyDefault) && (isDefaultLock()) && (!hasAdditionalFields()) && (!hasPartialAttributeExpressions()) && (!hasUnionExpressions()) && (!hasNonFetchJoinedAttributeExpressions()) && (this.fetchGroup == null) && (this.fetchGroupName == null) && (this.shouldUseDefaultFetchGroup); }
/** * INTERNAL: * Return true if the query uses default properties. * This is used to determine if this query is cacheable. * i.e. does not use any properties that may conflict with another query * with the same JPQL or selection criteria. */ @Override public boolean isDefaultPropertiesQuery() { return super.isDefaultPropertiesQuery() && (!this.isResultSetOptimizedQuery) && (this.isResultSetAccessOptimizedQuery == null || this.isResultSetAccessOptimizedQuery.equals(isResultSetAccessOptimizedQueryDefault)) && (this.shouldUseSerializedObjectPolicy == shouldUseSerializedObjectPolicyDefault) && (isDefaultLock()) && (!hasAdditionalFields()) && (!hasPartialAttributeExpressions()) && (!hasUnionExpressions()) && (!hasNonFetchJoinedAttributeExpressions()) && (this.fetchGroup == null) && (this.fetchGroupName == null) && (this.shouldUseDefaultFetchGroup); }
/** * INTERNAL: * Clone the query */ public Object clone() { ObjectLevelReadQuery cloneQuery = (ObjectLevelReadQuery)super.clone(); // Must also clone the joined expressions as always joined attribute will be added // don't use setters as this will trigger unprepare. if (cloneQuery.hasJoining()) { cloneQuery.joinedAttributeManager = (JoinedAttributeManager)cloneQuery.getJoinedAttributeManager().clone(); cloneQuery.joinedAttributeManager.setBaseQuery(cloneQuery); } if (hasNonFetchJoinedAttributeExpressions()){ cloneQuery.setNonFetchJoinAttributeExpressions(new ArrayList<Expression>(this.nonFetchJoinAttributeExpressions)); } // Don't use setters as that will trigger unprepare if (hasOrderByExpressions()) { cloneQuery.orderByExpressions = new ArrayList<Expression>(getOrderByExpressions()); } return cloneQuery; }
/** * INTERNAL: * Return true if the query uses default properties. * This is used to determine if this query is cacheable. * i.e. does not use any properties that may conflict with another query * with the same JPQL or selection criteria. */ public boolean isDefaultPropertiesQuery() { return super.isDefaultPropertiesQuery() && (isDefaultLock()) && (!isDistinctComputed()) && (!hasAdditionalFields()) && (!hasPartialAttributeExpressions()) && (!hasNonFetchJoinedAttributeExpressions()) && (!hasFetchGroup()) && (getFetchGroupName() == null) && (shouldUseDefaultFetchGroup()); }
/** * Return the appropriate select statement containing the fields in the table. */ protected SQLSelectStatement buildNormalSelectStatement() { // From bug 2612185 Remember the identity hashtable used in cloning the selection criteria even in the normal case // for performance, in case subqueries need it, or for order by expressions. // 2612538 - the default size of Map (32) is appropriate Map clonedExpressions = new IdentityHashMap(); SQLSelectStatement selectStatement = buildBaseSelectStatement(false, clonedExpressions); ObjectLevelReadQuery query = ((ObjectLevelReadQuery)getQuery()); // Case, normal read for branch inheritance class that reads subclasses all in its own table(s). if (getDescriptor().hasInheritance()) { getDescriptor().getInheritancePolicy().appendWithAllSubclassesExpression(selectStatement); if ((!query.isReportQuery()) && query.shouldOuterJoinSubclasses()) { selectStatement.getExpressionBuilder().setShouldUseOuterJoinForMultitableInheritance(true); } } selectStatement.setFields(getSelectionFields(selectStatement, true)); if (query.hasNonFetchJoinedAttributeExpressions()) { selectStatement.setNonSelectFields(cloneExpressions(query.getNonFetchJoinAttributeExpressions(), clonedExpressions)); } selectStatement.normalize(getSession(), getDescriptor(), clonedExpressions); // Allow for joining indexes to be computed to ensure distinct rows. if (((ObjectLevelReadQuery)getQuery()).hasJoining()) { ((ObjectLevelReadQuery)getQuery()).getJoinedAttributeManager().computeJoiningMappingIndexes(true, getSession(), 0); } return selectStatement; }
selectStatement.setOrderByExpressions(cloneExpressions(query.getOrderByExpressions(), clonedExpressions)); if (query.hasNonFetchJoinedAttributeExpressions()) { selectStatement.setNonSelectFields(cloneExpressions(query.getNonFetchJoinAttributeExpressions(), clonedExpressions));
selectStatement.setOrderByExpressions(cloneExpressions(query.getOrderByExpressions(), clonedExpressions)); if (query.hasNonFetchJoinedAttributeExpressions()) { selectStatement.setNonSelectFields(cloneExpressions(query.getNonFetchJoinAttributeExpressions(), clonedExpressions));