@Override public Class classFromRow(org.eclipse.persistence.internal.oxm.record.UnmarshalRecord unmarshalRecord, AbstractSession session) { UnmarshalRecord inheritanceRecord = new UnmarshalRecord(unmarshalRecord); return descriptor.getInheritancePolicy().classFromRow(inheritanceRecord, session); }
@Override public Class classFromRow(org.eclipse.persistence.internal.oxm.record.UnmarshalRecord unmarshalRecord, AbstractSession session) { UnmarshalRecord inheritanceRecord = new UnmarshalRecord(unmarshalRecord); return descriptor.getInheritancePolicy().classFromRow(inheritanceRecord, session); }
/** * INTERNAL: * Return a sub-partition of the row starting at the index. */ public AbstractRecord trimRowForJoin(AbstractRecord row, Object value, AbstractSession executionSession) { // CR #... the field for many objects may be in the row, // so build the subpartion of the row through the computed values in the query, // this also helps the field indexing match. int fieldStartIndex; if (value instanceof Integer) { fieldStartIndex = ((Integer)value).intValue(); } else { // must be Map of classes to Integers Map map = (Map)value; Class cls; if (getDescriptor().hasInheritance() && getDescriptor().getInheritancePolicy().shouldReadSubclasses()) { cls = getDescriptor().getInheritancePolicy().classFromRow(row, executionSession); } else { cls = getDescriptor().getJavaClass(); } fieldStartIndex = ((Integer)map.get(cls)).intValue(); } Vector trimedFields = new NonSynchronizedSubVector(row.getFields(), fieldStartIndex, row.size()); Vector trimedValues = new NonSynchronizedSubVector(row.getValues(), fieldStartIndex, row.size()); return new DatabaseRecord(trimedFields, trimedValues); }
/** * INTERNAL: * Return a sub-partition of the row starting at the index. */ public AbstractRecord trimRowForJoin(AbstractRecord row, Object value, AbstractSession executionSession) { // CR #... the field for many objects may be in the row, // so build the subpartion of the row through the computed values in the query, // this also helps the field indexing match. int fieldStartIndex; if (value instanceof Integer) { fieldStartIndex = ((Integer)value).intValue(); } else { // must be Map of classes to Integers Map map = (Map)value; Class cls; if (getDescriptor().hasInheritance() && getDescriptor().getInheritancePolicy().shouldReadSubclasses()) { cls = getDescriptor().getInheritancePolicy().classFromRow(row, executionSession); } else { cls = getDescriptor().getJavaClass(); } fieldStartIndex = ((Integer)map.get(cls)).intValue(); } Vector trimedFields = new NonSynchronizedSubVector(row.getFields(), fieldStartIndex, row.size()); Vector trimedValues = new NonSynchronizedSubVector(row.getValues(), fieldStartIndex, row.size()); return new DatabaseRecord(trimedFields, trimedValues); }
/** * INTERNAL: * Return a sub-partition of the row starting at the index. */ public AbstractRecord trimRowForJoin(AbstractRecord row, Object value, AbstractSession executionSession) { // CR #... the field for many objects may be in the row, // so build the subpartion of the row through the computed values in the query, // this also helps the field indexing match. int fieldStartIndex; if (value instanceof Integer) { fieldStartIndex = ((Integer)value).intValue(); } else { // must be Map of classes to Integers Map map = (Map)value; Class cls; if (getDescriptor().hasInheritance() && getDescriptor().getInheritancePolicy().shouldReadSubclasses()) { cls = getDescriptor().getInheritancePolicy().classFromRow(row, executionSession); } else { cls = getDescriptor().getJavaClass(); } fieldStartIndex = ((Integer)map.get(cls)).intValue(); } Vector trimedFields = new NonSynchronizedSubVector(row.getFields(), fieldStartIndex, row.size()); Vector trimedValues = new NonSynchronizedSubVector(row.getValues(), fieldStartIndex, row.size()); return new DatabaseRecord(trimedFields, trimedValues); }
Class newElementClass = descriptor.getInheritancePolicy().classFromRow(nestedRow, executionSession); descriptor = this.getReferenceDescriptor(newElementClass, executionSession);
Class classValue = descriptor.getInheritancePolicy().classFromRow(entityRecord, query.getSession()); descriptor = query.getSession().getDescriptor(classValue);
Class classValue = descriptor.getInheritancePolicy().classFromRow(entityRecord, query.getSession()); descriptor = query.getSession().getDescriptor(classValue);
/** * INTERNAL: * Select one row of any concrete subclass, * This must use two selects, the first retrieves the type field only. */ protected AbstractRecord selectOneRowUsingDefaultMultipleTableSubclassRead(ReadObjectQuery query) throws DatabaseException, QueryException { // Get the row for the given class indicator field // The indicator select is prepared in the original query, so can just be executed. AbstractRecord typeRow = ((ExpressionQueryMechanism)query.getQueryMechanism()).selectOneRowFromTable(); if (typeRow == null) { return null; } Class concreteClass = classFromRow(typeRow, query.getSession()); ClassDescriptor concreteDescriptor = getDescriptor(concreteClass); if (concreteDescriptor == null) { throw QueryException.noDescriptorForClassFromInheritancePolicy(query, concreteClass); } ReadObjectQuery concreteQuery = (ReadObjectQuery)query.clone(); concreteQuery.setReferenceClass(concreteClass); concreteQuery.setDescriptor(concreteDescriptor); AbstractRecord resultRow = ((ExpressionQueryMechanism)concreteQuery.getQueryMechanism()).selectOneRowFromConcreteTable(); return resultRow; }
/** * INTERNAL: * Select one row of any concrete subclass, * This must use two selects, the first retrieves the type field only. */ protected AbstractRecord selectOneRowUsingDefaultMultipleTableSubclassRead(ReadObjectQuery query) throws DatabaseException, QueryException { // Get the row for the given class indicator field // The indicator select is prepared in the original query, so can just be executed. AbstractRecord typeRow = ((ExpressionQueryMechanism)query.getQueryMechanism()).selectOneRowFromTable(); if (typeRow == null) { return null; } Class concreteClass = classFromRow(typeRow, query.getSession()); ClassDescriptor concreteDescriptor = getDescriptor(concreteClass); if (concreteDescriptor == null) { throw QueryException.noDescriptorForClassFromInheritancePolicy(query, concreteClass); } ReadObjectQuery concreteQuery = (ReadObjectQuery)query.clone(); concreteQuery.setReferenceClass(concreteClass); concreteQuery.setDescriptor(concreteDescriptor); AbstractRecord resultRow = ((ExpressionQueryMechanism)concreteQuery.getQueryMechanism()).selectOneRowFromConcreteTable(); return resultRow; }
/** * INTERNAL: * Select one row of any concrete subclass, * This must use two selects, the first retrieves the type field only. */ protected AbstractRecord selectOneRowUsingDefaultMultipleTableSubclassRead(ReadObjectQuery query) throws DatabaseException, QueryException { // Get the row for the given class indicator field // The indicator select is prepared in the original query, so can just be executed. AbstractRecord typeRow = ((ExpressionQueryMechanism)query.getQueryMechanism()).selectOneRowFromTable(); if (typeRow == null) { return null; } Class concreteClass = classFromRow(typeRow, query.getSession()); ClassDescriptor concreteDescriptor = getDescriptor(concreteClass); if (concreteDescriptor == null) { throw QueryException.noDescriptorForClassFromInheritancePolicy(query, concreteClass); } ReadObjectQuery concreteQuery = (ReadObjectQuery)query.clone(); concreteQuery.setReferenceClass(concreteClass); concreteQuery.setDescriptor(concreteDescriptor); AbstractRecord resultRow = ((ExpressionQueryMechanism)concreteQuery.getQueryMechanism()).selectOneRowFromConcreteTable(); return resultRow; }
/** * INTERNAL: * Builds a shallow original object. Only direct attributes and primary * keys are populated. In this way the minimum original required for * instantiating a working copy clone can be built without placing it in * the shared cache (no concern over cycles). */ public void buildShallowOriginalFromRow(AbstractRecord row, Object original, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, AbstractSession executionSession) { Object fieldValue = row.get(this.getField()); // BUG#2667762 there could be whitespace in the row instead of null if ((fieldValue == null) || (fieldValue instanceof String)) { return; } // pretty sure we can ignore inheritance here: AbstractRecord nestedRow = this.getReferenceDescriptor().buildNestedRowFromFieldValue(fieldValue); ClassDescriptor descriptor = this.getReferenceDescriptor(); if (descriptor.hasInheritance()) { Class nestedElementClass = descriptor.getInheritancePolicy().classFromRow(nestedRow, executionSession); descriptor = this.getReferenceDescriptor(nestedElementClass, executionSession); } ObjectBuilder objectBuilder = descriptor.getObjectBuilder(); // instead of calling buildCompositeObject, which calls either objectBuilder. // buildObject or buildNewInstance and buildAttributesIntoObject, do the // following always. Since shallow original no concern over cycles or caching. Object element = objectBuilder.buildNewInstance(); objectBuilder.buildAttributesIntoShallowObject(element, nestedRow, sourceQuery); setAttributeValueInObject(original, element); }
/** * INTERNAL: * Builds a shallow original object. Only direct attributes and primary * keys are populated. In this way the minimum original required for * instantiating a working copy clone can be built without placing it in * the shared cache (no concern over cycles). */ public void buildShallowOriginalFromRow(AbstractRecord row, Object original, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, AbstractSession executionSession) { Object fieldValue = row.get(this.getField()); // BUG#2667762 there could be whitespace in the row instead of null if ((fieldValue == null) || (fieldValue instanceof String)) { return; } // pretty sure we can ignore inheritance here: AbstractRecord nestedRow = this.getReferenceDescriptor().buildNestedRowFromFieldValue(fieldValue); ClassDescriptor descriptor = this.getReferenceDescriptor(); if (descriptor.hasInheritance()) { Class nestedElementClass = descriptor.getInheritancePolicy().classFromRow(nestedRow, executionSession); descriptor = this.getReferenceDescriptor(nestedElementClass, executionSession); } ObjectBuilder objectBuilder = descriptor.getObjectBuilder(); // instead of calling buildCompositeObject, which calls either objectBuilder. // buildObject or buildNewInstance and buildAttributesIntoObject, do the // following always. Since shallow original no concern over cycles or caching. Object element = objectBuilder.buildNewInstance(); objectBuilder.buildAttributesIntoShallowObject(element, nestedRow, sourceQuery); setAttributeValueInObject(original, element); }
/** * INTERNAL: * Builds a shallow original object. Only direct attributes and primary * keys are populated. In this way the minimum original required for * instantiating a working copy clone can be built without placing it in * the shared cache (no concern over cycles). */ public void buildShallowOriginalFromRow(AbstractRecord row, Object original, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, AbstractSession executionSession) { Object fieldValue = row.get(this.getField()); // BUG#2667762 there could be whitespace in the row instead of null if ((fieldValue == null) || (fieldValue instanceof String)) { return; } // pretty sure we can ignore inheritance here: AbstractRecord nestedRow = this.getReferenceDescriptor().buildNestedRowFromFieldValue(fieldValue); ClassDescriptor descriptor = this.getReferenceDescriptor(); if (descriptor.hasInheritance()) { Class nestedElementClass = descriptor.getInheritancePolicy().classFromRow(nestedRow, executionSession); descriptor = this.getReferenceDescriptor(nestedElementClass, executionSession); } ObjectBuilder objectBuilder = descriptor.getObjectBuilder(); // instead of calling buildCompositeObject, which calls either objectBuilder. // buildObject or buildNewInstance and buildAttributesIntoObject, do the // following always. Since shallow original no concern over cycles or caching. Object element = objectBuilder.buildNewInstance(); objectBuilder.buildAttributesIntoShallowObject(element, nestedRow, sourceQuery); setAttributeValueInObject(original, element); }
Class classValue = inheritancePolicy.classFromRow(databaseRow, session); concreteDescriptor = inheritancePolicy.getDescriptor(classValue); if ((concreteDescriptor == null) && query.hasPartialAttributeExpressions()) {
Class classValue = inheritancePolicy.classFromRow(databaseRow, session); concreteDescriptor = inheritancePolicy.getDescriptor(classValue); if ((concreteDescriptor == null) && query.hasPartialAttributeExpressions()) {
/** * INTERNAL: * Extract and return the aggregate object from * the specified row. */ public Object valueFromRow(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, AbstractSession executionSession) throws DatabaseException { Object fieldValue = row.get(this.getField()); // BUG#2667762 there could be whitespace in the row instead of null if ((fieldValue == null) || (fieldValue instanceof String)) { return null; } // pretty sure we can ignore inheritance here: AbstractRecord nestedRow = this.getReferenceDescriptor().buildNestedRowFromFieldValue(fieldValue); ClassDescriptor descriptor = this.getReferenceDescriptor(); if (descriptor.hasInheritance()) { Class nestedElementClass = descriptor.getInheritancePolicy().classFromRow(nestedRow, executionSession); descriptor = this.getReferenceDescriptor(nestedElementClass, executionSession); } ObjectBuilder objectBuilder = descriptor.getObjectBuilder(); Object toReturn = buildCompositeObject(objectBuilder, nestedRow, sourceQuery, joinManager); if(getConverter() != null) { toReturn = getConverter().convertDataValueToObjectValue(toReturn, executionSession); } return buildCompositeObject(objectBuilder, nestedRow, sourceQuery, joinManager); }
unmarshalRecord.setXMLReader(parentRecord.getXMLReader()); Class classValue = xmlDescriptor.getInheritancePolicy().classFromRow(unmarshalRecord, session); if (classValue == null) {
Class nestedElementClass = descriptor.getInheritancePolicy().classFromRow(nestedRow, executionSession); descriptor = getReferenceDescriptor(nestedElementClass, executionSession);
Class nestedElementClass = descriptor.getInheritancePolicy().classFromRow(nestedRow, executionSession); descriptor = getReferenceDescriptor(nestedElementClass, executionSession);