private void addChoiceElementMapping(List<XMLField> sourceFields, Class theClass, List<XMLField> targetFields) { XMLObjectReferenceMapping xmlMapping = new XMLObjectReferenceMapping(); xmlMapping.setReferenceClass(theClass); xmlMapping.setAttributeAccessor(temporaryAccessor); for(int i = 0; i < sourceFields.size(); i++) { XMLField sourceField = sourceFields.get(i); xmlMapping.addSourceToTargetKeyFieldAssociation(sourceField, targetFields.get(i)); this.choiceElementMappings.put(sourceField, xmlMapping); } this.choiceElementMappingsByClass.put(theClass, xmlMapping); }
private DatabaseMapping buildXMLObjectReferenceMapping(String mappingUri) { XMLObjectReferenceMapping mapping = new XMLObjectReferenceMapping(); mapping.setAttributeName(getName()); if (getType().isDataObjectType()) { getType().setImplClassName(SDOConstants.SDO_DATA_OBJECT_IMPL_CLASS_NAME); } mapping.setReferenceClassName(getType().getImplClassName()); mapping.setReferenceClass(getType().getImplClass()); String sourcexpath = getQualifiedXPath(getContainingType().getURI(), true); // Get reference ID property if it exists SDOProperty targetIDProp = getIDProp(getType()); if (targetIDProp != null) { String targetxpath = targetIDProp.getQualifiedXPath(getType().getURI(), true); mapping.addSourceToTargetKeyFieldAssociation(sourcexpath, targetxpath); } else { throw SDOException.noTargetIdSpecified(getType().getURI(), getType().getName()); } return mapping; }
private void addChoiceElementMapping(List<XMLField> sourceFields, Class theClass, List<XMLField> targetFields) { XMLObjectReferenceMapping xmlMapping = new XMLObjectReferenceMapping(); xmlMapping.setReferenceClass(theClass); xmlMapping.setAttributeAccessor(temporaryAccessor); for(int i = 0; i < sourceFields.size(); i++) { XMLField sourceField = sourceFields.get(i); xmlMapping.addSourceToTargetKeyFieldAssociation(sourceField, targetFields.get(i)); this.choiceElementMappings.put(sourceField, xmlMapping); } this.choiceElementMappingsByClass.put(theClass, xmlMapping); }
private DatabaseMapping buildXMLObjectReferenceMapping(String mappingUri) { XMLObjectReferenceMapping mapping = new XMLObjectReferenceMapping(); mapping.setAttributeName(getName()); if (getType().isDataObjectType()) { getType().setImplClassName(SDOConstants.SDO_DATA_OBJECT_IMPL_CLASS_NAME); } mapping.setReferenceClassName(getType().getImplClassName()); mapping.setReferenceClass(getType().getImplClass()); String sourcexpath = getQualifiedXPath(getContainingType().getURI(), true); // Get reference ID property if it exists SDOProperty targetIDProp = getIDProp(getType()); if (targetIDProp != null) { String targetxpath = targetIDProp.getQualifiedXPath(getType().getURI(), true); mapping.addSourceToTargetKeyFieldAssociation(sourcexpath, targetxpath); } else { throw SDOException.noTargetIdSpecified(getType().getURI(), getType().getName()); } return mapping; }
private void addChoiceElementMapping(XMLField sourceField, Class theClass, XMLField targetField) { XMLObjectReferenceMapping mapping = new XMLObjectReferenceMapping(); mapping.setReferenceClass(theClass); mapping.setAttributeAccessor(temporaryAccessor); mapping.addSourceToTargetKeyFieldAssociation(sourceField, targetField); this.choiceElementMappings.put(sourceField, mapping); this.choiceElementMappingsByClass.put(theClass, mapping); }
private void addChoiceElementMapping(XMLField sourceField, Class theClass, XMLField targetField) { XMLObjectReferenceMapping mapping = new XMLObjectReferenceMapping(); mapping.setReferenceClass(theClass); mapping.setAttributeAccessor(temporaryAccessor); mapping.addSourceToTargetKeyFieldAssociation(sourceField, targetField); this.choiceElementMappings.put(sourceField, mapping); this.choiceElementMappingsByClass.put(theClass, mapping); }
import org.eclipse.persistence.config.DescriptorCustomizer; import org.eclipse.persistence.descriptors.ClassDescriptor; import org.eclipse.persistence.oxm.mappings.XMLObjectReferenceMapping; public class PhoneNumberCustomizer implements DescriptorCustomizer { @Override public void customize(ClassDescriptor descriptor) throws Exception { descriptor.removeMappingForAttributeName("contact"); XMLObjectReferenceMapping contactMapping = new XMLObjectReferenceMapping(); contactMapping.setAttributeName("contact"); contactMapping.setReferenceClass(Employee.class); contactMapping.addSourceToTargetKeyFieldAssociation("contact/@eID", "eId/text()"); contactMapping.addSourceToTargetKeyFieldAssociation("contact/@country", "country/text()"); descriptor.addMapping(contactMapping); } }
if (null == referenceClass) { if(referenceClassName != null){ setReferenceClass(session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(referenceClassName));
if (null == referenceClass) { if(referenceClassName != null){ setReferenceClass(session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(referenceClassName));
setReferenceClass(session.getDatasourcePlatform().getConversionManager().convertClassNameToClass(getReferenceClassName()));