/** * INTERNAL: * Return if this is a full object query, not partial nor fetch group. */ public boolean shouldReadAllMappings() { return (!hasPartialAttributeExpressions()) && (this.fetchGroup == null); }
/** * INTERNAL: * Return if this is a full object query, not partial nor fetch group. */ public boolean shouldReadAllMappings() { return (!hasPartialAttributeExpressions()) && (this.fetchGroup == null); }
/** * INTERNAL: * Return if this is a full object query, not partial nor fetch group. */ public boolean shouldReadAllMappings() { return (!hasPartialAttributeExpressions()) && (!hasFetchGroup()); }
/** * INTERNAL: * Return if partial attribute. */ public boolean isPartialAttribute(String attributeName) { if (!hasPartialAttributeExpressions()) { return false; } List<Expression> partialAttributeExpressions = getPartialAttributeExpressions(); int size = partialAttributeExpressions.size(); for (int index = 0; index < size; index++) { QueryKeyExpression expression = (QueryKeyExpression)partialAttributeExpressions.get(index); while (!expression.getBaseExpression().isExpressionBuilder()) { expression = (QueryKeyExpression)expression.getBaseExpression(); } if (expression.getName().equals(attributeName)) { return true; } } return false; }
/** * 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: * Check if the mapping is part of the partial attributes. */ public boolean shouldReadMapping(DatabaseMapping mapping) { if ((!hasPartialAttributeExpressions()) && (!hasFetchGroup())) { return true; } String attrName = mapping.getAttributeName(); //bug 3659145 if (hasFetchGroup()) { return isFetchGroupAttribute(attrName); } return isPartialAttribute(attrName); }
/** * INTERNAL: * Return the fields selected by the query. * This includes the partial or joined fields. * This is only used for custom SQL executions. */ public Vector getSelectionFields() { if (hasPartialAttributeExpressions()) { return getPartialAttributeSelectionFields(true); } Vector fields = NonSynchronizedVector.newInstance(); if (getExecutionFetchGroup() != null) { fields.addAll(getFetchGroupSelectionFields()); } else { fields.addAll(getDescriptor().getAllSelectionFields(this)); } // Add joined fields. if (hasJoining()) { addJoinSelectionFields(fields, true); } if (hasAdditionalFields()) { // Add additional fields, use for batch reading m-m. fields.addAll(getAdditionalFields()); } return fields; }
/** * Return the fields required in the select clause. * This must now be called after normalization, so it will get the aliased fields */ public Vector getSelectionFields(SQLSelectStatement statement, boolean includeAllSubclassFields) { ObjectLevelReadQuery owner = (ObjectLevelReadQuery)getQuery(); if (owner.hasPartialAttributeExpressions()) { return owner.getPartialAttributeSelectionFields(false); } Vector fields = NonSynchronizedVector.newInstance(); if (owner.getExecutionFetchGroup() != null) { fields.addAll(owner.getFetchGroupSelectionFields()); } else { if (includeAllSubclassFields) { fields.addAll(getDescriptor().getAllSelectionFields(owner)); } else { fields.add(statement.getExpressionBuilder()); } } // Add joined fields. if (owner.hasJoining()) { owner.addJoinSelectionFields(fields, false); } if (owner.hasAdditionalFields()) { // Add additional fields, use for batch reading m-m. fields.addAll(owner.getAdditionalFields()); } return fields; }
/** * INTERNAL: * Return the fields selected by the query. * This includes the partial or joined fields. * This is only used for custom SQL executions. */ public Vector getSelectionFields() { if (hasPartialAttributeExpressions()) { return getPartialAttributeSelectionFields(true); } Vector fields = NonSynchronizedVector.newInstance(); if (getExecutionFetchGroup() != null) { fields.addAll(getFetchGroupSelectionFields()); } else { fields.addAll(getDescriptor().getAllSelectionFields(this)); } // Add joined fields. if (hasJoining()) { addJoinSelectionFields(fields, true); } if (hasAdditionalFields()) { // Add additional fields, use for batch reading m-m. fields.addAll(getAdditionalFields()); } return fields; }
/** * Return the fields required in the select clause. * This must now be called after normalization, so it will get the aliased fields */ public Vector getSelectionFields(SQLSelectStatement statement, boolean includeAllSubclassFields) { ObjectLevelReadQuery owner = (ObjectLevelReadQuery)getQuery(); if (owner.hasPartialAttributeExpressions()) { return owner.getPartialAttributeSelectionFields(false); } Vector fields = NonSynchronizedVector.newInstance(); if (owner.getExecutionFetchGroup() != null) { fields.addAll(owner.getFetchGroupSelectionFields()); } else { if (includeAllSubclassFields) { fields.addAll(getDescriptor().getAllSelectionFields(owner)); } else { fields.add(statement.getExpressionBuilder()); } } // Add joined fields. if (owner.hasJoining()) { owner.addJoinSelectionFields(fields, false); } if (owner.hasAdditionalFields()) { // Add additional fields, use for batch reading m-m. fields.addAll(owner.getAdditionalFields()); } return fields; }
/** * 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()); }
/** * INTERNAL: * Return the fields selected by the query. * This includes the partial or joined fields. * This is only used for custom SQL executions. */ public Vector getSelectionFields() { if (hasPartialAttributeExpressions()) { return getPartialAttributeSelectionFields(true); } else if (hasFetchGroup()) { return getFetchGroupSelectionFields(true); } else if (hasJoining()) { JoinedAttributeManager joinManager = getJoinedAttributeManager(); Vector fields = NonSynchronizedVector.newInstance(getDescriptor().getAllFields().size() + joinManager.getJoinedAttributeExpressions().size() + joinManager.getJoinedMappingExpressions().size()); Helper.addAllToVector(fields, getDescriptor().getAllFields()); addSelectionFieldsForJoinedExpressions(fields, joinManager.getJoinedAttributeExpressions()); addSelectionFieldsForJoinedExpressions(fields, joinManager.getJoinedMappingExpressions()); return fields; } return getDescriptor().getAllFields(); }
if (owner.hasPartialAttributeExpressions()) { return owner.getPartialAttributeSelectionFields(false);
if (query.hasPartialAttributeExpressions()) {
/** * INTERNAL: * Add mandatory attributes to fetch group, create entityFetchGroup. */ public void prepareFetchGroup() throws QueryException { FetchGroupManager fetchGroupManager = this.descriptor.getFetchGroupManager(); if (fetchGroupManager != null) { if (this.fetchGroup == null) { if (this.fetchGroupName != null) { this.fetchGroup = fetchGroupManager.getFetchGroup(this.fetchGroupName); } else if (this.shouldUseDefaultFetchGroup) { this.fetchGroup = this.descriptor.getFetchGroupManager().getDefaultFetchGroup(); } } if (this.fetchGroup != null) { if (hasPartialAttributeExpressions()) { //fetch group does not work with partial attribute reading throw QueryException.fetchGroupNotSupportOnPartialAttributeReading(); } // currently SOP is incompatible with fetch groups setShouldUseSerializedObjectPolicy(false); this.descriptor.getFetchGroupManager().prepareAndVerify(this.fetchGroup); } } else { // FetchGroupManager is null if (this.fetchGroup != null || this.fetchGroupName != null) { throw QueryException.fetchGroupValidOnlyIfFetchGroupManagerInDescriptor(getDescriptor().getJavaClassName(), getName()); } } }
throw QueryException.refreshNotPossibleWithoutCache(this); if (shouldMaintainCache() && hasPartialAttributeExpressions()) { throw QueryException.cannotCachePartialObjects(this); if (hasPartialAttributeExpressions()) { for (int index = 0; index < getPartialAttributeExpressions().size(); index++) { Expression expression = getPartialAttributeExpressions().get(index);
throw QueryException.refreshNotPossibleWithoutCache(this); if (shouldMaintainCache() && hasPartialAttributeExpressions()) { throw QueryException.cannotCachePartialObjects(this); if (hasPartialAttributeExpressions()) { for (int index = 0; index < getPartialAttributeExpressions().size(); index++) { Expression expression = getPartialAttributeExpressions().get(index);
if (objectQuery.hasPartialAttributeExpressions()) { nestedObjectQuery.setPartialAttributeExpressions(extractNestedExpressions(objectQuery.getPartialAttributeExpressions(), nestedObjectQuery.getExpressionBuilder()));