use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class MapCollectionsProject method buildAEOTMValueDescriptor.
protected void buildAEOTMValueDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(AEOTMMapValue.class);
Vector vector = new Vector();
vector.addElement("AE_OM_ENT_MAP_VALUE");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("AE_OM_ENT_MAP_VALUE.ID");
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
descriptor.setExistenceChecking("Check cache");
descriptor.setIdentityMapSize(100);
// 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("AE_OM_ENT_MAP_VALUE.ID");
descriptor.addMapping(directtofieldmapping);
OneToOneMapping holderMapping = new OneToOneMapping();
holderMapping.setAttributeName("holder");
holderMapping.setReferenceClass(AggregateEntity1MMapHolder.class);
holderMapping.useBasicIndirection();
holderMapping.setGetMethodName("getHolder");
holderMapping.setSetMethodName("setHolder");
holderMapping.addForeignKeyFieldName("AE_OM_ENT_MAP_VALUE.HOLDER_ID", "AGG_ENT_1M_MAP_HOLDER.ID");
descriptor.addMapping(holderMapping);
addDescriptor(descriptor);
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class MapCollectionsProject method buildEntityDirectMapHolderDescriptor.
protected void buildEntityDirectMapHolderDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(EntityDirectMapHolder.class);
Vector vector = new Vector();
vector.addElement("ENT_DIR_MAP_HOLDER");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("ENT_DIR_MAP_HOLDER.ID");
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
descriptor.setExistenceChecking("Check cache");
descriptor.setIdentityMapSize(100);
descriptor.setSequenceNumberName("ENT_DIR_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("ENT_DIR_MAP_HOLDER.ID");
descriptor.addMapping(directtofieldmapping);
DirectMapMapping directMapMapping = new DirectMapMapping();
directMapMapping.setAttributeName("entityToDirectMap");
directMapMapping.setGetMethodName("getEntityToDirectMap");
directMapMapping.setSetMethodName("setEntityToDirectMap");
directMapMapping.setReferenceTableName("ENT_DIR_MAP_REL");
directMapMapping.setDirectFieldName("ENT_DIR_MAP_REL.MAP_VALUE");
directMapMapping.addReferenceKeyFieldName("ENT_DIR_MAP_REL.HOLDER_ID", "ENT_DIR_MAP_HOLDER.ID");
directMapMapping.setDirectFieldClassification(Integer.class);
directMapMapping.setIndirectionPolicy(new TransparentIndirectionPolicy());
org.eclipse.persistence.mappings.OneToOneMapping keyMapping = new org.eclipse.persistence.mappings.OneToOneMapping();
keyMapping.setReferenceClass(EntityMapKey.class);
keyMapping.addForeignKeyFieldName("ENT_DIR_MAP_REL.KEY_ID", "ENT_MAP_KEY.ID");
keyMapping.dontUseIndirection();
keyMapping.setDescriptor(descriptor);
MappedKeyMapContainerPolicy policy = new MappedKeyMapContainerPolicy(IndirectMap.class);
policy.setKeyMapping(keyMapping);
policy.setValueMapping(directMapMapping);
directMapMapping.setContainerPolicy(policy);
descriptor.addMapping(directMapMapping);
addDescriptor(descriptor);
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class MapCollectionsProject method buildDirectDirectMapHolderDescriptor.
protected void buildDirectDirectMapHolderDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(DirectDirectMapHolder.class);
Vector vector = new Vector();
vector.addElement("DIR_DIR_MAP_HOLDER");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("DIR_DIR_MAP_HOLDER.ID");
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
descriptor.setExistenceChecking("Check cache");
descriptor.setIdentityMapSize(100);
descriptor.setSequenceNumberName("DIR_DIR_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_DIR_MAP_HOLDER.ID");
descriptor.addMapping(directtofieldmapping);
DirectMapMapping directMapMapping = new DirectMapMapping();
directMapMapping.setAttributeName("directToDirectMap");
directMapMapping.setReferenceTableName("DIR_DIR_MAP_REL");
directMapMapping.setDirectFieldName("DIR_DIR_MAP_REL.MAP_VALUE");
directMapMapping.addReferenceKeyFieldName("DIR_DIR_MAP_REL.HOLDER_ID", "DIR_DIR_MAP_HOLDER.ID");
directMapMapping.setDirectFieldClassification(Integer.class);
directMapMapping.setIndirectionPolicy(new TransparentIndirectionPolicy());
org.eclipse.persistence.mappings.DirectToFieldMapping keyMapping = new org.eclipse.persistence.mappings.DirectToFieldMapping();
keyMapping.setFieldName("DIR_DIR_MAP_REL.MAP_KEY");
keyMapping.setAttributeClassification(Integer.class);
keyMapping.setDescriptor(descriptor);
MappedKeyMapContainerPolicy policy = new MappedKeyMapContainerPolicy(IndirectMap.class);
policy.setKeyMapping(keyMapping);
policy.setValueMapping(directMapMapping);
directMapMapping.setContainerPolicy(policy);
descriptor.addMapping(directMapMapping);
addDescriptor(descriptor);
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class MapCollectionsProject method buildDirectAggregateMapHolderDescriptor.
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);
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class BigBadProject method buildBigBadReferenceDataDescriptor.
public RelationalDescriptor buildBigBadReferenceDataDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.models.bigbad.BigBadReferenceData.class);
descriptor.addTableName("BIG_BAD_DATA");
descriptor.addPrimaryKeyFieldName("BIG_BAD_DATA.ID");
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setFieldName("BIG_BAD_DATA.ID");
descriptor.addMapping(idMapping);
DirectToFieldMapping dataMapping = new DirectToFieldMapping();
dataMapping.setAttributeName("data");
dataMapping.setFieldName("BIG_BAD_DATA.DATA");
descriptor.addMapping(dataMapping);
return descriptor;
}
Aggregations