/** * Each mapping is recursed to assign values from the Record to the attributes in the domain object. */ public void buildAttributesIntoObject(Object domainObject, CacheKey cacheKey, AbstractRecord databaseRow, ObjectBuildingQuery query, JoinedAttributeManager joinManager, FetchGroup executionFetchGroup, boolean forRefresh, AbstractSession targetSession) throws DatabaseException { if (this.descriptor.hasSerializedObjectPolicy() && query.shouldUseSerializedObjectPolicy()) { if (buildAttributesIntoObjectSOP(domainObject, cacheKey, databaseRow, query, joinManager, executionFetchGroup, forRefresh, targetSession)) { return; } } // PERF: Avoid synchronized enumerator as is concurrency bottleneck. List mappings = this.descriptor.getMappings(); // PERF: Cache if all mappings should be read. boolean readAllMappings = query.shouldReadAllMappings(); boolean isTargetProtected = targetSession.isProtectedSession(); int size = mappings.size(); for (int index = 0; index < size; index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); if (readAllMappings || query.shouldReadMapping(mapping, executionFetchGroup)) { mapping.readFromRowIntoObject(databaseRow, joinManager, domainObject, cacheKey, query, targetSession, isTargetProtected); } } // PERF: Avoid events if no listeners. if (this.descriptor.hasEventManager()) { postBuildAttributesIntoObjectEvent(domainObject, databaseRow, query, forRefresh); } }
/** * Each mapping is recursed to assign values from the Record to the attributes in the domain object. */ public void buildAttributesIntoObject(Object domainObject, CacheKey cacheKey, AbstractRecord databaseRow, ObjectBuildingQuery query, JoinedAttributeManager joinManager, FetchGroup executionFetchGroup, boolean forRefresh, AbstractSession targetSession) throws DatabaseException { if (this.descriptor.hasSerializedObjectPolicy() && query.shouldUseSerializedObjectPolicy()) { if (buildAttributesIntoObjectSOP(domainObject, cacheKey, databaseRow, query, joinManager, executionFetchGroup, forRefresh, targetSession)) { return; } } // PERF: Avoid synchronized enumerator as is concurrency bottleneck. List mappings = this.descriptor.getMappings(); // PERF: Cache if all mappings should be read. boolean readAllMappings = query.shouldReadAllMappings(); boolean isTargetProtected = targetSession.isProtectedSession(); int size = mappings.size(); for (int index = 0; index < size; index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); if (readAllMappings || query.shouldReadMapping(mapping, executionFetchGroup)) { mapping.readFromRowIntoObject(databaseRow, joinManager, domainObject, cacheKey, query, targetSession, isTargetProtected); } } // PERF: Avoid events if no listeners. if (this.descriptor.hasEventManager()) { postBuildAttributesIntoObjectEvent(domainObject, databaseRow, query, 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); } } // 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); } }
protected void loadJoinedAttributes(ClassDescriptor concreteDescriptor, Object sourceObject, CacheKey cacheKey, AbstractRecord databaseRow, JoinedAttributeManager joinManager, ObjectBuildingQuery query, boolean isTargetProtected){ boolean useOnlyMappingsExcludedFromSOP = false; if (concreteDescriptor.hasSerializedObjectPolicy() && query.shouldUseSerializedObjectPolicy()) {
protected void loadJoinedAttributes(ClassDescriptor concreteDescriptor, Object sourceObject, CacheKey cacheKey, AbstractRecord databaseRow, JoinedAttributeManager joinManager, ObjectBuildingQuery query, boolean isTargetProtected){ boolean useOnlyMappingsExcludedFromSOP = false; if (concreteDescriptor.hasSerializedObjectPolicy() && query.shouldUseSerializedObjectPolicy()) {
protected void loadBatchReadAttributes(ClassDescriptor concreteDescriptor, Object sourceObject, CacheKey cacheKey, AbstractRecord databaseRow, ObjectBuildingQuery query, JoinedAttributeManager joinManager, boolean isTargetProtected){ boolean useOnlyMappingsExcludedFromSOP = false; if (concreteDescriptor.hasSerializedObjectPolicy() && query.shouldUseSerializedObjectPolicy()) {
protected void loadBatchReadAttributes(ClassDescriptor concreteDescriptor, Object sourceObject, CacheKey cacheKey, AbstractRecord databaseRow, ObjectBuildingQuery query, JoinedAttributeManager joinManager, boolean isTargetProtected){ boolean useOnlyMappingsExcludedFromSOP = false; if (concreteDescriptor.hasSerializedObjectPolicy() && query.shouldUseSerializedObjectPolicy()) {
if (descriptor.hasSerializedObjectPolicy() && query.shouldUseSerializedObjectPolicy() && !databaseRow.hasSopObject()) {
if (descriptor.hasSerializedObjectPolicy() && query.shouldUseSerializedObjectPolicy() && !databaseRow.hasSopObject()) {
nestedQuery.setShouldUseSerializedObjectPolicy(baseQuery.shouldUseSerializedObjectPolicy());
nestedQuery.setShouldUseSerializedObjectPolicy(baseQuery.shouldUseSerializedObjectPolicy());
boolean isSopQuery = concreteDescriptor.hasSerializedObjectPolicy() && query.shouldUseSerializedObjectPolicy();
boolean isSopQuery = concreteDescriptor.hasSerializedObjectPolicy() && query.shouldUseSerializedObjectPolicy();