/** */ private Object getType(DatabaseMapping mapping) { if (mapping == null) { return null; } Object type = null; if (mapping.isForeignReferenceMapping()) { ClassDescriptor descriptor = mapping.getReferenceDescriptor(); type = descriptor == null ? null : descriptor.getJavaClass(); } else if (mapping.isAggregateMapping()) { // Return the ClassDescriptor as the type representation in case // of an embeeded. This makese sure that any property or field // access of the embedded uses the correct mapping information and // not the shell of the descriptors as stored by the session. type = ((AggregateMapping)mapping).getReferenceDescriptor(); } else { type = mapping.getAttributeClassification(); } return type; }
setPKClass(ConversionManager.getObjectClass(mapping.getAttributeClassification())); elementIsFound = null; } else { setPKClass(ConversionManager.getObjectClass(mapping.getAttributeClassification())); elementIsFound = null; } else {
if (constructorArgTypes[i]==null){ if((constructorMappings != null)&&(constructorMappings.get(i)!=null)){ constructorArgTypes[i] = ((DatabaseMapping)constructorMappings.get(i)).getAttributeClassification(); }else if (ritem.getResultType() != null) { constructorArgTypes[i] = ritem.getResultType();
/** * INTERNAL: * Used to update a changeRecord that is stored in the CHangeSet with a new value. */ public void updateChangeRecordForAttribute(DatabaseMapping mapping, Object value) { String attributeName = mapping.getAttributeName(); ChangeRecord changeRecord = (ChangeRecord)getChangesForAttributeNamed(attributeName); // bug 2641228 always ensure that we convert the value to the correct type value = ConversionManager.getDefaultManager().convertObject(value, mapping.getAttributeClassification()); if (changeRecord != null) { changeRecord.updateChangeRecordWithNewValue(value); } else if (mapping.isDirectToFieldMapping()) { //if it is direct to field then this is most likely the result of a forced update and // we will need to merge this object changeRecord = new DirectToFieldChangeRecord(this); changeRecord.setAttribute(attributeName); changeRecord.setMapping(mapping); ((DirectToFieldChangeRecord)changeRecord).setNewValue(value); this.addChange(changeRecord); } }