/** * INTERNAL: * Extract the primary key values from the row, then create an * org.eclipse.persistence.internal.oxm.Reference instance and stored it * on the session's org.eclipse.persistence.internal.oxm.ReferenceResolver. */ public Object readFromRowIntoObject(AbstractRecord databaseRow, JoinedAttributeManager joinManager, Object targetObject, CacheKey parentCacheKey, ObjectBuildingQuery sourceQuery, AbstractSession executionSession, boolean isTargetProtected, Object container) throws DatabaseException { ClassDescriptor descriptor = sourceQuery.getSession().getClassDescriptor(getReferenceClass()); if(container == null){ readFromRowIntoObject(databaseRow, joinManager, targetObject, parentCacheKey, sourceQuery, executionSession, isTargetProtected); } // for each source xmlField, get the value from the row and store for (Iterator fieldIt = getFields().iterator(); fieldIt.hasNext();) { XMLField fld = (XMLField) fieldIt.next(); // Object fieldValue = databaseRow.getValues(fld); if ((fieldValue == null) || (fieldValue instanceof String) || !(fieldValue instanceof Vector)) { return container; } // fix for bug# 5687430 // need to get the actual type of the target (i.e. int, String, etc.) // and use the converted value when checking the cache. for (Iterator valIt = ((Vector) fieldValue).iterator(); valIt.hasNext();) { Object nextValue = valIt.next(); DOMRecord domRecord = (DOMRecord) databaseRow; this.buildReference(domRecord.getCurrentObject(), fld, nextValue, sourceQuery.getSession(), container, domRecord.getReferenceResolver()); } } return null; }
readFromRowIntoObject(databaseRow, joinManager, targetObject, parentCacheKey, sourceQuery, executionSession, isTargetProtected);
/** * INTERNAL: * Extract the primary key values from the row, then create an * org.eclipse.persistence.internal.oxm.Reference instance and stored it * on the session's org.eclipse.persistence.internal.oxm.ReferenceResolver. */ public Object readFromRowIntoObject(AbstractRecord databaseRow, JoinedAttributeManager joinManager, Object targetObject, CacheKey parentCacheKey, ObjectBuildingQuery sourceQuery, AbstractSession executionSession, boolean isTargetProtected) throws DatabaseException { ContainerPolicy cp = getContainerPolicy(); Object container = null; if (reuseContainer) { Object currentObject = ((XMLRecord) databaseRow).getCurrentObject(); container = getAttributeAccessor().getAttributeValueFromObject(currentObject); } if(container == null){ container = cp.containerInstance(); } return readFromRowIntoObject(databaseRow, joinManager, targetObject, parentCacheKey, sourceQuery, executionSession, isTargetProtected, container); }
/** * INTERNAL: * Extract the primary key values from the row, then create an * org.eclipse.persistence.internal.oxm.Reference instance and stored it * on the session's org.eclipse.persistence.internal.oxm.ReferenceResolver. */ public Object readFromRowIntoObject(AbstractRecord databaseRow, JoinedAttributeManager joinManager, Object targetObject, CacheKey parentCacheKey, ObjectBuildingQuery sourceQuery, AbstractSession executionSession, boolean isTargetProtected) throws DatabaseException { ContainerPolicy cp = getContainerPolicy(); Object container = null; if (reuseContainer) { Object currentObject = ((XMLRecord) databaseRow).getCurrentObject(); container = getAttributeAccessor().getAttributeValueFromObject(currentObject); } if(container == null){ container = cp.containerInstance(); } return readFromRowIntoObject(databaseRow, joinManager, targetObject, parentCacheKey, sourceQuery, executionSession, isTargetProtected, container); }
public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed) throws DatabaseException { List<XMLEntry> values = ((DOMRecord)row).getValuesIndicatingNoEntry(this.getFields()); Object container = getContainerPolicy().containerInstance(values.size()); for(XMLEntry next:values) { Field valueField = next.getXMLField(); DatabaseMapping nextMapping = (DatabaseMapping)this.choiceElementMappings.get(valueField); if(nextMapping.isAbstractCompositeCollectionMapping()) { XMLCompositeCollectionMapping xmlMapping = (XMLCompositeCollectionMapping)nextMapping; Object value = xmlMapping.buildObjectFromNestedRow((AbstractRecord)next.getValue(), joinManager, sourceQuery, executionSession, isTargetProtected); value = convertDataValueToObjectValue(value, executionSession, ((XMLRecord) row).getUnmarshaller()); getContainerPolicy().addInto(value, container, executionSession); } else if(nextMapping instanceof XMLCompositeDirectCollectionMapping){ XMLCompositeDirectCollectionMapping xmlMapping = (XMLCompositeDirectCollectionMapping)nextMapping; Object value = next.getValue(); value = convertDataValueToObjectValue(value, executionSession, ((XMLRecord) row).getUnmarshaller()); getContainerPolicy().addInto(value, container, executionSession); } } ArrayList<XMLMapping> processedMappings = new ArrayList<XMLMapping>(); for(XMLMapping mapping:choiceElementMappings.values()) { if(((DatabaseMapping)mapping).isObjectReferenceMapping() && ((DatabaseMapping)mapping).isCollectionMapping() && !(processedMappings.contains(mapping))) { ((XMLCollectionReferenceMapping)mapping).readFromRowIntoObject(row, joinManager, ((XMLRecord)row).getCurrentObject(), cacheKey, sourceQuery, executionSession, isTargetProtected, container); processedMappings.add(mapping); } } return container; }
public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, CacheKey cacheKey, AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed) throws DatabaseException { List<XMLEntry> values = ((DOMRecord)row).getValuesIndicatingNoEntry(this.getFields()); Object container = getContainerPolicy().containerInstance(values.size()); for(XMLEntry next:values) { Field valueField = next.getXMLField(); DatabaseMapping nextMapping = (DatabaseMapping)this.choiceElementMappings.get(valueField); if(nextMapping.isAbstractCompositeCollectionMapping()) { XMLCompositeCollectionMapping xmlMapping = (XMLCompositeCollectionMapping)nextMapping; Object value = xmlMapping.buildObjectFromNestedRow((AbstractRecord)next.getValue(), joinManager, sourceQuery, executionSession, isTargetProtected); value = convertDataValueToObjectValue(value, executionSession, ((XMLRecord) row).getUnmarshaller()); getContainerPolicy().addInto(value, container, executionSession); } else if(nextMapping instanceof XMLCompositeDirectCollectionMapping){ XMLCompositeDirectCollectionMapping xmlMapping = (XMLCompositeDirectCollectionMapping)nextMapping; Object value = next.getValue(); value = convertDataValueToObjectValue(value, executionSession, ((XMLRecord) row).getUnmarshaller()); getContainerPolicy().addInto(value, container, executionSession); } } ArrayList<XMLMapping> processedMappings = new ArrayList<XMLMapping>(); for(XMLMapping mapping:choiceElementMappings.values()) { if(((DatabaseMapping)mapping).isObjectReferenceMapping() && ((DatabaseMapping)mapping).isCollectionMapping() && !(processedMappings.contains(mapping))) { ((XMLCollectionReferenceMapping)mapping).readFromRowIntoObject(row, joinManager, ((XMLRecord)row).getCurrentObject(), cacheKey, sourceQuery, executionSession, isTargetProtected, container); processedMappings.add(mapping); } } return container; }