@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; }
/** * Build the row representation of an object. * This is only used for aggregates. */ public AbstractRecord buildRowWithChangeSet(AbstractRecord databaseRow, ObjectChangeSet objectChangeSet, AbstractSession session, WriteType writeType) { List<ChangeRecord> changes = (List)objectChangeSet.getChanges(); int size = changes.size(); for (int index = 0; index < size; index++) { ChangeRecord changeRecord = changes.get(index); DatabaseMapping mapping = changeRecord.getMapping(); mapping.writeFromObjectIntoRowWithChangeRecord(changeRecord, databaseRow, session, writeType); } // If this descriptor is involved in inheritance add the class type. if (this.descriptor.hasInheritance()) { this.descriptor.getInheritancePolicy().addClassIndicatorFieldToRow(databaseRow); } // If the session uses multi-tenancy, add the tenant id field. if (getDescriptor().hasMultitenantPolicy()) { getDescriptor().getMultitenantPolicy().addFieldsToRow(databaseRow, session); } return databaseRow; }
/** * Build the row representation of an object. * This is only used for aggregates. */ public AbstractRecord buildRowWithChangeSet(AbstractRecord databaseRow, ObjectChangeSet objectChangeSet, AbstractSession session, WriteType writeType) { List<ChangeRecord> changes = (List)objectChangeSet.getChanges(); int size = changes.size(); for (int index = 0; index < size; index++) { ChangeRecord changeRecord = changes.get(index); DatabaseMapping mapping = changeRecord.getMapping(); mapping.writeFromObjectIntoRowWithChangeRecord(changeRecord, databaseRow, session, writeType); } // If this descriptor is involved in inheritance add the class type. if (this.descriptor.hasInheritance()) { this.descriptor.getInheritancePolicy().addClassIndicatorFieldToRow(databaseRow); } // If the session uses multi-tenancy, add the tenant id field. if (getDescriptor().hasMultitenantPolicy()) { getDescriptor().getMultitenantPolicy().addFieldsToRow(databaseRow, session); } return databaseRow; }
/** * Build the row representation of the object for update. The row built does not * contain entries for uninstantiated attributes. */ public AbstractRecord buildRowForShallowInsert(AbstractRecord databaseRow, Object object, AbstractSession session) { // PERF: Avoid synchronized enumerator as is concurrency bottleneck. List mappings = this.descriptor.getMappings(); int mappingsSize = mappings.size(); for (int index = 0; index < mappingsSize; index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); mapping.writeFromObjectIntoRowForShallowInsert(object, databaseRow, session); } // If this descriptor is involved in inheritance add the class type. if (this.descriptor.hasInheritance()) { this.descriptor.getInheritancePolicy().addClassIndicatorFieldToRow(databaseRow); } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables. if (!this.descriptor.isAggregateDescriptor()) { addPrimaryKeyForNonDefaultTable(databaseRow, object, session); } // If the session uses multi-tenancy, add the tenant id field. if (getDescriptor().hasMultitenantPolicy()) { getDescriptor().getMultitenantPolicy().addFieldsToRow(databaseRow, session); } return databaseRow; }
/** * Build the row representation of the object for update. The row built does not * contain entries for uninstantiated attributes. */ public AbstractRecord buildRowForShallowInsert(AbstractRecord databaseRow, Object object, AbstractSession session) { // PERF: Avoid synchronized enumerator as is concurrency bottleneck. List mappings = this.descriptor.getMappings(); int mappingsSize = mappings.size(); for (int index = 0; index < mappingsSize; index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); mapping.writeFromObjectIntoRowForShallowInsert(object, databaseRow, session); } // If this descriptor is involved in inheritance add the class type. if (this.descriptor.hasInheritance()) { this.descriptor.getInheritancePolicy().addClassIndicatorFieldToRow(databaseRow); } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables. if (!this.descriptor.isAggregateDescriptor()) { addPrimaryKeyForNonDefaultTable(databaseRow, object, session); } // If the session uses multi-tenancy, add the tenant id field. if (getDescriptor().hasMultitenantPolicy()) { getDescriptor().getMultitenantPolicy().addFieldsToRow(databaseRow, session); } return databaseRow; }
/** * INTERNAL: * Build and return a clone of the attribute. */ protected Object buildClonePart(Object attributeValue, Object clone, CacheKey parentCacheKey, Integer refreshCascade, AbstractSession cloningSession, boolean isNewObject) { if (attributeValue == null) { return null; } if (cloningSession.isUnitOfWork() && isNewObject) { // only true if cloningSession is UOW as this signature only exists in this mapping. ((UnitOfWorkImpl)cloningSession).addNewAggregate(attributeValue); } // Do not clone for read-only. if (cloningSession.isUnitOfWork() && cloningSession.isClassReadOnly(attributeValue.getClass())){ return attributeValue; } ObjectBuilder aggregateObjectBuilder = getObjectBuilder(attributeValue, cloningSession); // bug 2612602 as we are building the working copy make sure that we call to correct clone method. Object clonedAttributeValue = aggregateObjectBuilder.instantiateWorkingCopyClone(attributeValue, cloningSession); aggregateObjectBuilder.populateAttributesForClone(attributeValue, parentCacheKey, clonedAttributeValue, refreshCascade, cloningSession); //also clone the fetch group reference if applied if (aggregateObjectBuilder.getDescriptor().hasFetchGroupManager()) { aggregateObjectBuilder.getDescriptor().getFetchGroupManager().copyAggregateFetchGroupInto(attributeValue, clonedAttributeValue, clone, cloningSession); } return clonedAttributeValue; }
if(primaryKeyFields.isEmpty() && getDescriptor().isAggregateCollectionDescriptor()) { DatabaseTable defaultTable = getDescriptor().getDefaultTable(); Iterator<DatabaseField> it = getDescriptor().getFields().iterator(); while(it.hasNext()) { DatabaseField field = it.next();
if (getDescriptor().hasMultitenantPolicy()) { getDescriptor().getMultitenantPolicy().addFieldsToRow(databaseRow, query.getExecutionSession());
/** * Build the row representation of an object. */ public AbstractRecord buildRow(AbstractRecord databaseRow, Object object, AbstractSession session, WriteType writeType) { // PERF: Avoid synchronized enumerator as is concurrency bottleneck. List mappings = this.descriptor.getMappings(); int mappingsSize = mappings.size(); for (int index = 0; index < mappingsSize; index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); mapping.writeFromObjectIntoRow(object, databaseRow, session, writeType); } // If this descriptor is involved in inheritance add the class type. if (this.descriptor.hasInheritance()) { this.descriptor.getInheritancePolicy().addClassIndicatorFieldToRow(databaseRow); } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables. if (this.descriptor.hasMultipleTables() && !this.descriptor.isAggregateDescriptor()) { addPrimaryKeyForNonDefaultTable(databaseRow, object, session); } // If the session uses multi-tenancy, add the tenant id field. if (getDescriptor().hasMultitenantPolicy()) { getDescriptor().getMultitenantPolicy().addFieldsToRow(databaseRow, session); } return databaseRow; } /**
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; } }
/** * Build the row representation of an object. */ public AbstractRecord buildRow(AbstractRecord databaseRow, Object object, AbstractSession session, WriteType writeType) { // PERF: Avoid synchronized enumerator as is concurrency bottleneck. List mappings = this.descriptor.getMappings(); int mappingsSize = mappings.size(); for (int index = 0; index < mappingsSize; index++) { DatabaseMapping mapping = (DatabaseMapping)mappings.get(index); mapping.writeFromObjectIntoRow(object, databaseRow, session, writeType); } // If this descriptor is involved in inheritance add the class type. if (this.descriptor.hasInheritance()) { this.descriptor.getInheritancePolicy().addClassIndicatorFieldToRow(databaseRow); } // If this descriptor has multiple tables then we need to append the primary keys for // the non default tables. if (this.descriptor.hasMultipleTables() && !this.descriptor.isAggregateDescriptor()) { addPrimaryKeyForNonDefaultTable(databaseRow, object, session); } // If the session uses multi-tenancy, add the tenant id field. if (getDescriptor().hasMultitenantPolicy()) { getDescriptor().getMultitenantPolicy().addFieldsToRow(databaseRow, session); } return databaseRow; } /**
/** * INTERNAL: * Build and return a clone of the attribute. */ protected Object buildClonePart(Object attributeValue, Object clone, CacheKey parentCacheKey, Integer refreshCascade, AbstractSession cloningSession, boolean isNewObject) { if (attributeValue == null) { return null; } if (cloningSession.isUnitOfWork() && isNewObject) { // only true if cloningSession is UOW as this signature only exists in this mapping. ((UnitOfWorkImpl)cloningSession).addNewAggregate(attributeValue); } // Do not clone for read-only. if (cloningSession.isUnitOfWork() && cloningSession.isClassReadOnly(attributeValue.getClass())){ return attributeValue; } ObjectBuilder aggregateObjectBuilder = getObjectBuilder(attributeValue, cloningSession); // bug 2612602 as we are building the working copy make sure that we call to correct clone method. Object clonedAttributeValue = aggregateObjectBuilder.instantiateWorkingCopyClone(attributeValue, cloningSession); aggregateObjectBuilder.populateAttributesForClone(attributeValue, parentCacheKey, clonedAttributeValue, refreshCascade, cloningSession); //also clone the fetch group reference if applied if (aggregateObjectBuilder.getDescriptor().hasFetchGroupManager()) { aggregateObjectBuilder.getDescriptor().getFetchGroupManager().copyAggregateFetchGroupInto(attributeValue, clonedAttributeValue, clone, cloningSession); } return clonedAttributeValue; }
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; } }
if (getDescriptor().hasMultitenantPolicy()) { getDescriptor().getMultitenantPolicy().addFieldsToRow(databaseRow, query.getExecutionSession());
if (getDescriptor() == mapping.getDescriptor()){ ((ContainerMapping)mapping).getContainerPolicy().processAdditionalWritableMapKeyFields(session); DatabaseField lockField = this.descriptor.getOptimisticLockingPolicy().getWriteLockField(); if (lockField != null) { DatabaseMapping lockMapping = getDescriptor().getObjectBuilder().getMappingForField(lockField); if (lockMapping != null) { this.lockAttribute = lockMapping.getAttributeName();
mappings = getCurrentDescriptor().getObjectBuilder().getDescriptor().getMappings(); } else { ObjectBuilder builder = getCurrentDescriptor().getObjectBuilder().getDescriptor().getObjectBuilder();
mappings = getCurrentDescriptor().getObjectBuilder().getDescriptor().getMappings(); } else { ObjectBuilder builder = getCurrentDescriptor().getObjectBuilder().getDescriptor().getObjectBuilder();
session.log(SessionLog.FINEST, SessionLog.QUERY, "field_for_unsupported_mapping_returned", databaseField, getDescriptor()); return null;
session.log(SessionLog.FINEST, SessionLog.QUERY, "field_for_unsupported_mapping_returned", databaseField, getDescriptor()); return null;