/** * INTERNAL: * Extract value from the row and set the attribute to the value in the object. * @since EclipseLink 2.6.0 */ @Override public Object readFromRowIntoObject(XMLRecord row, Object object, AbstractSession executionSession, boolean isTargetProtected) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setSession(executionSession); return readFromRowIntoObject(row, null, object, null, query, executionSession, isTargetProtected); }
/** * INTERNAL: * Extract value from the row and set the attribute to the value in the object. * @since EclipseLink 2.6.0 */ @Override public Object readFromRowIntoObject(XMLRecord row, Object object, AbstractSession executionSession, boolean isTargetProtected) throws DatabaseException { ReadObjectQuery query = new ReadObjectQuery(); query.setSession(executionSession); return readFromRowIntoObject(row, null, object, null, query, executionSession, isTargetProtected); }
protected void populateTargetObjectFromRecord(Vector<DatabaseMapping> mappings, AbstractRecord record, Object targetObject, AbstractSession session) { ReadObjectQuery roq = new ReadObjectQuery(); roq.setSession(session); for (DatabaseMapping dm : mappings) { dm.readFromRowIntoObject(record, null, targetObject, null, roq, session, true); } }
protected void populateTargetObjectFromRecord(Vector<DatabaseMapping> mappings, AbstractRecord record, Object targetObject, AbstractSession session) { ReadObjectQuery roq = new ReadObjectQuery(); roq.setSession(session); for (DatabaseMapping dm : mappings) { dm.readFromRowIntoObject(record, null, targetObject, null, roq, session, true); } }
/** * Assign the fields in the row back into the object. * This is used by returning, as well as events and version locking. * If not null changeSet must correspond to object. changeSet is updated with all of the field values in the row. */ public void assignReturnRow(Object object, AbstractSession writeSession, AbstractRecord row, ObjectChangeSet changeSet) throws DatabaseException { writeSession.log(SessionLog.FINEST, SessionLog.QUERY, "assign_return_row", row); // Require a query context to read into an object. ReadObjectQuery query = new ReadObjectQuery(); query.setSession(writeSession); // To avoid processing the same mapping twice, // maintain Collection of mappings already used. HashSet handledMappings = null; int size = row.size(); if (size > 1) { handledMappings = new HashSet(size); } List fields = row.getFields(); for (int index = 0; index < size; index++) { DatabaseField field = (DatabaseField)fields.get(index); assignReturnValueForField(object, query, row, field, handledMappings, changeSet); } }
/** * Assign the fields in the row back into the object. * This is used by returning, as well as events and version locking. */ public void assignReturnRow(Object object, AbstractSession writeSession, AbstractRecord row) throws DatabaseException { writeSession.log(SessionLog.FINEST, SessionLog.QUERY, "assign_return_row", row); // Require a query context to read into an object. ReadObjectQuery query = new ReadObjectQuery(); query.setSession(writeSession); // To avoid processing the same mapping twice, // maintain Collection of mappings already used. HashSet handledMappings = null; int size = row.size(); if (size > 1) { handledMappings = new HashSet(size); } List fields = row.getFields(); for (int index = 0; index < size; index++) { DatabaseField field = (DatabaseField)fields.get(index); assignReturnValueForField(object, query, row, field, handledMappings); } }
/** * Assign the fields in the row back into the object. * This is used by returning, as well as events and version locking. * If not null changeSet must correspond to object. changeSet is updated with all of the field values in the row. */ public void assignReturnRow(Object object, AbstractSession writeSession, AbstractRecord row, ObjectChangeSet changeSet) throws DatabaseException { writeSession.log(SessionLog.FINEST, SessionLog.QUERY, "assign_return_row", row); // Require a query context to read into an object. ReadObjectQuery query = new ReadObjectQuery(); query.setSession(writeSession); // To avoid processing the same mapping twice, // maintain Collection of mappings already used. HashSet handledMappings = null; int size = row.size(); if (size > 1) { handledMappings = new HashSet(size); } List fields = row.getFields(); for (int index = 0; index < size; index++) { DatabaseField field = (DatabaseField)fields.get(index); assignReturnValueForField(object, query, row, field, handledMappings, changeSet); } }
/** * INTERNAL: * This method is used to load a relationship from a list of PKs. * This list may be available if the relationship has been cached. */ @Override public Object valueFromPKList(Object[] pks, AbstractRecord foreignKeys, AbstractSession session) { if (pks.length == 0 || pks[0] == null) return null; ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(getReferenceClass()); query.setSelectionId(pks[0]); query.setIsExecutionClone(true); query.setSession(session); return session.executeQuery(query); }
/** * INTERNAL: * This method is used to load a relationship from a list of PKs. * This list may be available if the relationship has been cached. */ @Override public Object valueFromPKList(Object[] pks, AbstractRecord foreignKeys, AbstractSession session) { if (pks.length == 0 || pks[0] == null) return null; ReadObjectQuery query = new ReadObjectQuery(); query.setReferenceClass(getReferenceClass()); query.setSelectionId(pks[0]); query.setIsExecutionClone(true); query.setSession(session); return session.executeQuery(query); }
/** * INTERNAL: * Clone the attribute from the original and assign it to the clone. */ @Override public void buildClone(Object original, CacheKey cacheKey, Object clone, Integer refreshCascade, AbstractSession cloningSession) { Object attributeValue = null; if (!this.isCacheable && (cacheKey != null && !cacheKey.isIsolated())){ ReadObjectQuery query = new ReadObjectQuery(descriptor.getJavaClass()); query.setSession(cloningSession); attributeValue = valueFromRow(cacheKey.getProtectedForeignKeys(), null, query, cacheKey, cloningSession, true, null); }else{ attributeValue = getAttributeValueFromObject(original); } attributeValue = this.indirectionPolicy.cloneAttribute(attributeValue, original, cacheKey, clone, refreshCascade, cloningSession, false); // building clone from an original not a row. //GFBug#404 - fix moved to ObjectBuildingQuery.registerIndividualResult setAttributeValueInObject(clone, attributeValue); }
/** * INTERNAL: * Clone the attribute from the original and assign it to the clone. */ @Override public void buildClone(Object original, CacheKey cacheKey, Object clone, Integer refreshCascade, AbstractSession cloningSession) { Object attributeValue = null; if (!this.isCacheable && (cacheKey != null && !cacheKey.isIsolated())){ ReadObjectQuery query = new ReadObjectQuery(descriptor.getJavaClass()); query.setSession(cloningSession); attributeValue = valueFromRow(cacheKey.getProtectedForeignKeys(), null, query, cacheKey, cloningSession, true, null); }else{ attributeValue = getAttributeValueFromObject(original); } attributeValue = this.indirectionPolicy.cloneAttribute(attributeValue, original, cacheKey, clone, refreshCascade, cloningSession, false); // building clone from an original not a row. //GFBug#404 - fix moved to ObjectBuildingQuery.registerIndividualResult setAttributeValueInObject(clone, attributeValue); }
AbstractRecord nestedRow = ((ObjectRelationalDataTypeDescriptor)descriptor).buildRowFromStructure((Struct)value); ReadObjectQuery query = new ReadObjectQuery(); query.setSession(this.getQuery().getSession()); value = descriptor.getObjectBuilder().buildNewInstance(); descriptor.getObjectBuilder().buildAttributesIntoObject(value, nestedRow, query, null, false);
AbstractRecord nestedRow = ((ObjectRelationalDataTypeDescriptor)descriptor).buildRowFromStructure((Struct)value); ReadObjectQuery query = new ReadObjectQuery(); query.setSession(session); value = descriptor.getObjectBuilder().buildNewInstance(); descriptor.getObjectBuilder().buildAttributesIntoObject(value, null, nestedRow, query, null, null, false, this.getQuery().getSession());
AbstractRecord nestedRow = ((ObjectRelationalDataTypeDescriptor)descriptor).buildRowFromStructure((Struct)value); ReadObjectQuery query = new ReadObjectQuery(); query.setSession(session); value = descriptor.getObjectBuilder().buildNewInstance(); descriptor.getObjectBuilder().buildAttributesIntoObject(value, null, nestedRow, query, null, null, false, this.getQuery().getSession());
AbstractRecord row = getMapping().getDescriptor().getObjectBuilder().buildRow(object, session); ReadObjectQuery query = new ReadObjectQuery(); query.setSession(((RemoteUnitOfWork) session).getParent()); valueHolder = (ValueHolderInterface) getMapping().valueFromRow(row, null, query); } else {
AbstractRecord row = this.mapping.getDescriptor().getObjectBuilder().buildRow(object, session, WriteType.UNDEFINED); ReadObjectQuery query = new ReadObjectQuery(); query.setSession(session); valueHolder = (ValueHolderInterface) this.mapping.valueFromRow(row, null, query, true);
AbstractRecord row = this.mapping.getDescriptor().getObjectBuilder().buildRow(object, session, WriteType.UNDEFINED); ReadObjectQuery query = new ReadObjectQuery(); query.setSession(session); valueHolder = (ValueHolderInterface) this.mapping.valueFromRow(row, null, query, true);
query.setSession(writeSession); DatabaseMapping mapping = getBaseMappingForField(sequenceNumberField); Object sequenceIntoObject = getParentObjectForField(sequenceNumberField, object);
query.setSession(session); ContainerPolicy cp = ContainerPolicy.buildPolicyFor(arrayField.getType()); Object container = cp.containerInstance(objects.length);
query.setSession(session); ContainerPolicy cp = ContainerPolicy.buildPolicyFor(arrayField.getType()); Object container = cp.containerInstance(objects.length);