@Override protected Object buildCompositeObject(ObjectBuilder objectBuilder, AbstractRecord nestedRow, ObjectBuildingQuery query, CacheKey parentCacheKey, JoinedAttributeManager joinManager, AbstractSession targetSession) { Object aggregateObject = objectBuilder.buildNewInstance(); objectBuilder.buildAttributesIntoObject(aggregateObject, parentCacheKey, nestedRow, query, joinManager, query.getExecutionFetchGroup(objectBuilder.getDescriptor()), false, targetSession); return aggregateObject; }
@Override protected Object buildCompositeObject(ObjectBuilder objectBuilder, AbstractRecord nestedRow, ObjectBuildingQuery query, CacheKey parentCacheKey, JoinedAttributeManager joinManager, AbstractSession targetSession) { Object aggregateObject = objectBuilder.buildNewInstance(); objectBuilder.buildAttributesIntoObject(aggregateObject, parentCacheKey, nestedRow, query, joinManager, query.getExecutionFetchGroup(objectBuilder.getDescriptor()), false, targetSession); return aggregateObject; }
@Override protected Object buildCompositeObject(ClassDescriptor descriptor, AbstractRecord nestedRow, ObjectBuildingQuery query, CacheKey parentCacheKey, JoinedAttributeManager joinManager, AbstractSession targetSession) { Object element = descriptor.getObjectBuilder().buildNewInstance(); descriptor.getObjectBuilder().buildAttributesIntoObject(element, parentCacheKey, nestedRow, query, joinManager, query.getExecutionFetchGroup(descriptor), false, targetSession); return element; }
@Override protected Object buildCompositeObject(ClassDescriptor descriptor, AbstractRecord nestedRow, ObjectBuildingQuery query, CacheKey parentCacheKey, JoinedAttributeManager joinManager, AbstractSession targetSession) { Object element = descriptor.getObjectBuilder().buildNewInstance(); descriptor.getObjectBuilder().buildAttributesIntoObject(element, parentCacheKey, nestedRow, query, joinManager, query.getExecutionFetchGroup(descriptor), false, targetSession); return element; }
FetchGroup fetchGroup = getBaseQuery().getExecutionFetchGroup(); if(fetchGroup != null) { fetchGroupAttributes = fetchGroup.getAttributeNames();
FetchGroup fetchGroup = getBaseQuery().getExecutionFetchGroup(); if(fetchGroup != null) { fetchGroupAttributes = fetchGroup.getAttributeNames();
protected Object buildCompositeObject(ObjectBuilder objectBuilder, AbstractRecord nestedRow, ObjectBuildingQuery query, CacheKey parentCacheKey, JoinedAttributeManager joinManager, AbstractSession targetSession) { if (((EISDescriptor)getDescriptor()).isXMLFormat()) { return objectBuilder.buildObject(query, nestedRow, joinManager); } else { Object aggregateObject = objectBuilder.buildNewInstance(); objectBuilder.buildAttributesIntoObject(aggregateObject, parentCacheKey, nestedRow, query, joinManager, query.getExecutionFetchGroup(objectBuilder.getDescriptor()), false, targetSession); return aggregateObject; } }
protected Object buildCompositeObject(ObjectBuilder objectBuilder, AbstractRecord nestedRow, ObjectBuildingQuery query, CacheKey parentCacheKey, JoinedAttributeManager joinManager, AbstractSession targetSession) { if (((EISDescriptor)getDescriptor()).isXMLFormat()) { return objectBuilder.buildObject(query, nestedRow, joinManager); } else { Object aggregateObject = objectBuilder.buildNewInstance(); objectBuilder.buildAttributesIntoObject(aggregateObject, parentCacheKey, nestedRow, query, joinManager, query.getExecutionFetchGroup(objectBuilder.getDescriptor()), false, targetSession); return aggregateObject; } }
@Override protected Object buildCompositeObject(ClassDescriptor descriptor, AbstractRecord nestedRow, ObjectBuildingQuery query, CacheKey parentsCacheKey, JoinedAttributeManager joinManager, AbstractSession targetSession) { if (((EISDescriptor)descriptor).isXMLFormat()) { return descriptor.getObjectBuilder().buildObject(query, nestedRow, joinManager); } else { Object element = descriptor.getObjectBuilder().buildNewInstance(); descriptor.getObjectBuilder().buildAttributesIntoObject(element, parentsCacheKey, nestedRow, query, joinManager, query.getExecutionFetchGroup(descriptor), false, targetSession); return element; } }
@Override protected Object buildCompositeObject(ClassDescriptor descriptor, AbstractRecord nestedRow, ObjectBuildingQuery query, CacheKey parentsCacheKey, JoinedAttributeManager joinManager, AbstractSession targetSession) { if (((EISDescriptor)descriptor).isXMLFormat()) { return descriptor.getObjectBuilder().buildObject(query, nestedRow, joinManager); } else { Object element = descriptor.getObjectBuilder().buildNewInstance(); descriptor.getObjectBuilder().buildAttributesIntoObject(element, parentsCacheKey, nestedRow, query, joinManager, query.getExecutionFetchGroup(descriptor), false, targetSession); return element; } }
/** * INTERNAL: * For reading through the write connection when in transaction, * populate the clone directly from the database row. */ public void buildAttributesIntoWorkingCopyClone(Object clone, CacheKey sharedCacheKey, ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, UnitOfWorkImpl unitOfWork, boolean forRefresh) throws DatabaseException, QueryException { if (this.descriptor.hasSerializedObjectPolicy() && query.shouldUseSerializedObjectPolicy()) { if (buildAttributesIntoWorkingCopyCloneSOP(clone, sharedCacheKey, query, joinManager, databaseRow, unitOfWork, forRefresh)) { return; } } // PERF: Cache if all mappings should be read. boolean readAllMappings = query.shouldReadAllMappings(); List mappings = this.descriptor.getMappings(); int size = mappings.size(); FetchGroup executionFetchGroup = query.getExecutionFetchGroup(this.descriptor); for (int index = 0; index < size; index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); if (readAllMappings || query.shouldReadMapping(mapping, executionFetchGroup)) { mapping.buildCloneFromRow(databaseRow, joinManager, clone, sharedCacheKey, query, unitOfWork, unitOfWork); } } // PERF: Avoid events if no listeners. if (this.descriptor.getEventManager().hasAnyEventListeners()) { postBuildAttributesIntoWorkingCopyCloneEvent(clone, databaseRow, query, unitOfWork, forRefresh); } }
/** * INTERNAL: * For reading through the write connection when in transaction, * populate the clone directly from the database row. */ public void buildAttributesIntoWorkingCopyClone(Object clone, CacheKey sharedCacheKey, ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, UnitOfWorkImpl unitOfWork, boolean forRefresh) throws DatabaseException, QueryException { if (this.descriptor.hasSerializedObjectPolicy() && query.shouldUseSerializedObjectPolicy()) { if (buildAttributesIntoWorkingCopyCloneSOP(clone, sharedCacheKey, query, joinManager, databaseRow, unitOfWork, forRefresh)) { return; } } // PERF: Cache if all mappings should be read. boolean readAllMappings = query.shouldReadAllMappings(); List mappings = this.descriptor.getMappings(); int size = mappings.size(); FetchGroup executionFetchGroup = query.getExecutionFetchGroup(this.descriptor); for (int index = 0; index < size; index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); if (readAllMappings || query.shouldReadMapping(mapping, executionFetchGroup)) { mapping.buildCloneFromRow(databaseRow, joinManager, clone, sharedCacheKey, query, unitOfWork, unitOfWork, !readAllMappings); } } // PERF: Avoid events if no listeners. if (this.descriptor.getEventManager().hasAnyEventListeners()) { postBuildAttributesIntoWorkingCopyCloneEvent(clone, databaseRow, query, unitOfWork, forRefresh); } }
/** * Clean up the cached object data and only revert the fetch group data back to the cached object. */ private void revertFetchGroupData(Object domainObject, ClassDescriptor concreteDescriptor, CacheKey cacheKey, ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, AbstractSession session, boolean targetIsProtected) { FetchGroup fetchGroup = query.getExecutionFetchGroup(concreteDescriptor); FetchGroupManager fetchGroupManager = concreteDescriptor.getFetchGroupManager(); //the cached object is either invalidated, or staled as the version is newer, or a refresh is explicitly set on the query. //clean all data of the cache object. fetchGroupManager.reset(domainObject); //set fetch group reference to the cached object fetchGroupManager.setObjectFetchGroup(domainObject, fetchGroupManager.getEntityFetchGroup(fetchGroup), session); // Bug 276362 - set the CacheKey's read time (to re-validate the CacheKey) before buildAttributesIntoObject is called cacheKey.setReadTime(query.getExecutionTime()); //read in the fetch group data only concreteDescriptor.getObjectBuilder().buildAttributesIntoObject(domainObject, cacheKey, databaseRow, query, joinManager, fetchGroup, false, session); //set refresh on fetch group fetchGroupManager.setRefreshOnFetchGroupToObject(domainObject, (query.shouldRefreshIdentityMapResult() || concreteDescriptor.shouldAlwaysRefreshCache())); //set query id to prevent infinite recursion on refresh object cascade all cacheKey.setLastUpdatedQueryId(query.getQueryId()); //register the object into the IM and set the write lock object if applied. if (concreteDescriptor.usesOptimisticLocking()) { OptimisticLockingPolicy policy = concreteDescriptor.getOptimisticLockingPolicy(); cacheKey.setWriteLockValue(policy.getValueToPutInCache(databaseRow, session)); } }
/** * Clean up the cached object data and only revert the fetch group data back to the cached object. */ private void revertFetchGroupData(Object domainObject, ClassDescriptor concreteDescriptor, CacheKey cacheKey, ObjectBuildingQuery query, JoinedAttributeManager joinManager, AbstractRecord databaseRow, AbstractSession session, boolean targetIsProtected) { FetchGroup fetchGroup = query.getExecutionFetchGroup(concreteDescriptor); FetchGroupManager fetchGroupManager = concreteDescriptor.getFetchGroupManager(); //the cached object is either invalidated, or staled as the version is newer, or a refresh is explicitly set on the query. //clean all data of the cache object. fetchGroupManager.reset(domainObject); //set fetch group reference to the cached object fetchGroupManager.setObjectFetchGroup(domainObject, fetchGroupManager.getEntityFetchGroup(fetchGroup), session); // Bug 276362 - set the CacheKey's read time (to re-validate the CacheKey) before buildAttributesIntoObject is called cacheKey.setReadTime(query.getExecutionTime()); //read in the fetch group data only concreteDescriptor.getObjectBuilder().buildAttributesIntoObject(domainObject, cacheKey, databaseRow, query, joinManager, fetchGroup, false, session); //set refresh on fetch group fetchGroupManager.setRefreshOnFetchGroupToObject(domainObject, (query.shouldRefreshIdentityMapResult() || concreteDescriptor.shouldAlwaysRefreshCache())); //set query id to prevent infinite recursion on refresh object cascade all cacheKey.setLastUpdatedQueryId(query.getQueryId()); //register the object into the IM and set the write lock object if applied. if (concreteDescriptor.usesOptimisticLocking()) { OptimisticLockingPolicy policy = concreteDescriptor.getOptimisticLockingPolicy(); cacheKey.setWriteLockValue(policy.getValueToPutInCache(databaseRow, session)); } }
FetchGroup fetchGroup = query.getExecutionFetchGroup(concreteDescriptor); FetchGroupManager fetchGroupManager = concreteDescriptor.getFetchGroupManager();
FetchGroup fetchGroup = query.getExecutionFetchGroup(concreteDescriptor); FetchGroupManager fetchGroupManager = concreteDescriptor.getFetchGroupManager();
nestedObjectQuery.computeBatchReadAttributes(); FetchGroup parentQueryFetchGroup = sourceQuery.getExecutionFetchGroup(this.descriptor); if (parentQueryFetchGroup != null) { if (nestedObjectQuery == objectQuery) {
nestedObjectQuery.computeBatchReadAttributes(); FetchGroup parentQueryFetchGroup = sourceQuery.getExecutionFetchGroup(this.descriptor); if (parentQueryFetchGroup != null) { if (nestedObjectQuery == objectQuery) {
descriptor.getObjectBuilder().buildAttributesIntoWorkingCopyClone(aggregate, buildWrapperCacheKeyForAggregate(cacheKey, targetIsProtected), nestedQuery, joinManager, databaseRow, (UnitOfWorkImpl)executionSession, refreshing); } else { descriptor.getObjectBuilder().buildAttributesIntoObject(aggregate, buildWrapperCacheKeyForAggregate(cacheKey, targetIsProtected), databaseRow, nestedQuery, joinManager, nestedQuery.getExecutionFetchGroup(descriptor), refreshing, executionSession);
descriptor.getObjectBuilder().buildAttributesIntoWorkingCopyClone(aggregate, buildWrapperCacheKeyForAggregate(cacheKey, targetIsProtected), nestedQuery, joinManager, databaseRow, (UnitOfWorkImpl)executionSession, refreshing); } else { descriptor.getObjectBuilder().buildAttributesIntoObject(aggregate, buildWrapperCacheKeyForAggregate(cacheKey, targetIsProtected), databaseRow, nestedQuery, joinManager, nestedQuery.getExecutionFetchGroup(descriptor), refreshing, executionSession);