protected void buildDirectAggregateMapHolderDescriptor() { RelationalDescriptor descriptor = new RelationalDescriptor(); // SECTION: DESCRIPTOR descriptor.setJavaClass(DirectAggregateMapHolder.class); Vector vector = new Vector(); vector.addElement("DIR_AGG_MAP_HOLDER"); descriptor.setTableNames(vector); descriptor.addPrimaryKeyFieldName("DIR_AGG_MAP_HOLDER.ID"); // SECTION: PROPERTIES descriptor.setIdentityMapClass( org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class); descriptor.setExistenceChecking("Check cache"); descriptor.setIdentityMapSize(100); descriptor.setSequenceNumberName("DIR_AGG_MAP_HOLDER_ID"); descriptor.setSequenceNumberFieldName("ID"); // SECTION: DIRECTTOFIELDMAPPING org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping = new org.eclipse.persistence.mappings.DirectToFieldMapping(); directtofieldmapping.setAttributeName("id"); directtofieldmapping.setIsReadOnly(false); directtofieldmapping.setGetMethodName("getId"); directtofieldmapping.setSetMethodName("setId"); directtofieldmapping.setFieldName("DIR_AGG_MAP_HOLDER.ID"); descriptor.addMapping(directtofieldmapping); // SECTION: AGGREGATECOLLECTIONMAPPING org.eclipse.persistence.mappings.AggregateCollectionMapping aggregatecollectionmapping = new org.eclipse.persistence.mappings.AggregateCollectionMapping(); aggregatecollectionmapping.setAttributeName("directToAggregateMap"); aggregatecollectionmapping.setIndirectionPolicy(new TransparentIndirectionPolicy()); aggregatecollectionmapping.setGetMethodName("getDirectToAggregateMap"); aggregatecollectionmapping.setSetMethodName("setDirectToAggregateMap"); aggregatecollectionmapping.setReferenceClass(AggregateMapValue.class); aggregatecollectionmapping.addTargetForeignKeyFieldName( "DIR_AGG_MAP_REL.HOLDER_ID", "DIR_AGG_MAP_HOLDER.ID"); aggregatecollectionmapping.addFieldNameTranslation( "DIR_AGG_MAP_REL.MAP_VALUE", "value->DIRECT"); org.eclipse.persistence.mappings.DirectToFieldMapping keyMapping = new org.eclipse.persistence.mappings.DirectToFieldMapping(); keyMapping.setFieldName("DIR_AGG_MAP_REL.MAP_KEY"); keyMapping.setAttributeClassification(Integer.class); keyMapping.setDescriptor(descriptor); MappedKeyMapContainerPolicy policy = new MappedKeyMapContainerPolicy(IndirectMap.class); policy.setKeyMapping(keyMapping); policy.setValueMapping(aggregatecollectionmapping); aggregatecollectionmapping.setContainerPolicy(policy); descriptor.addMapping(aggregatecollectionmapping); addDescriptor(descriptor); }
public void test() throws Exception { DirectToFieldMapping map = new DirectToFieldMapping(); map.setAttributeName("foobar"); map.setAttributeClassification(Hashtable.class); try { map.getObjectValue("foobar", getSession()); } catch (ConversionException e) { m_exception = e; } }
protected void buildAggregateMapKeyDescriptor() { RelationalDescriptor descriptor = new RelationalDescriptor(); descriptor.descriptorIsAggregateCollection(); descriptor.setJavaClass(AggregateMapKey.class); // Descriptor Properties. descriptor.setAlias("AggregateMapKey"); // Mappings. DirectToFieldMapping keyMapping = new DirectToFieldMapping(); keyMapping.setAttributeName("key"); keyMapping.setFieldName("key->DIRECT"); keyMapping.setAttributeClassification(Integer.class); descriptor.addMapping(keyMapping); addDescriptor(descriptor); }