use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class MapCollectionsProject method buildAggregateDirectMapHolderDescriptor.
protected void buildAggregateDirectMapHolderDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(AggregateDirectMapHolder.class);
Vector vector = new Vector();
vector.addElement("AGG_DIR_MAP_HOLDER");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("AGG_DIR_MAP_HOLDER.ID");
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
descriptor.setExistenceChecking("Check cache");
descriptor.setIdentityMapSize(100);
descriptor.setSequenceNumberName("AGG_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("AGG_DIR_MAP_HOLDER.ID");
descriptor.addMapping(directtofieldmapping);
DirectMapMapping directMapMapping = new DirectMapMapping();
directMapMapping.setAttributeName("aggregateToDirectMap");
directMapMapping.setGetMethodName("getAggregateToDirectMap");
directMapMapping.setSetMethodName("setAggregateToDirectMap");
directMapMapping.setReferenceTableName("AGG_DIR_MAP_REL");
directMapMapping.setDirectFieldName("AGG_DIR_MAP_REL.MAP_VALUE");
directMapMapping.addReferenceKeyFieldName("AGG_DIR_MAP_REL.HOLDER_ID", "AGG_DIR_MAP_HOLDER.ID");
directMapMapping.setDirectFieldClassification(Integer.class);
directMapMapping.setIndirectionPolicy(new TransparentIndirectionPolicy());
AggregateObjectMapping keyMapping = new AggregateObjectMapping();
keyMapping.setReferenceClass(AggregateMapKey.class);
keyMapping.addFieldNameTranslation("AGG_DIR_MAP_REL.MAP_KEY", "key->DIRECT");
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 buildEntityAggregateMapHolderDescriptor.
protected void buildEntityAggregateMapHolderDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(EntityAggregateMapHolder.class);
Vector vector = new Vector();
vector.addElement("ENT_AGG_MAP_HOLDER");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("ENT_AGG_MAP_HOLDER.ID");
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
descriptor.setExistenceChecking("Check cache");
descriptor.setIdentityMapSize(100);
descriptor.setSequenceNumberName("ENT_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("ENT_AGG_MAP_HOLDER.ID");
descriptor.addMapping(directtofieldmapping);
// SECTION: AGGREGATECOLLECTIONMAPPING
org.eclipse.persistence.mappings.AggregateCollectionMapping aggregatecollectionmapping = new org.eclipse.persistence.mappings.AggregateCollectionMapping();
aggregatecollectionmapping.setAttributeName("entityToAggregateMap");
aggregatecollectionmapping.setIndirectionPolicy(new TransparentIndirectionPolicy());
aggregatecollectionmapping.setGetMethodName("getEntityToAggregateMap");
aggregatecollectionmapping.setSetMethodName("setEntityToAggregateMap");
aggregatecollectionmapping.setReferenceClass(AggregateMapValue.class);
aggregatecollectionmapping.addTargetForeignKeyFieldName("ENT_AGG_MAP_REL.HOLDER_ID", "ENT_AGG_MAP_HOLDER.ID");
aggregatecollectionmapping.addFieldNameTranslation("ENT_AGG_MAP_REL.MAP_VALUE", "value->DIRECT");
org.eclipse.persistence.mappings.OneToOneMapping keyMapping = new org.eclipse.persistence.mappings.OneToOneMapping();
keyMapping.setReferenceClass(EntityMapKey.class);
keyMapping.addForeignKeyFieldName("ENT_AGG_MAP_REL.KEY_ID", "ENT_MAP_KEY.ID");
keyMapping.dontUseIndirection();
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 MapCollectionsProject method buildEntityEntityU1MMapHolderDescriptor.
protected void buildEntityEntityU1MMapHolderDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(EntityEntityU1MMapHolder.class);
Vector vector = new Vector();
vector.addElement("ENT_ENT_U1M_MAP_HOLDER");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("ENT_ENT_U1M_MAP_HOLDER.ID");
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
descriptor.setExistenceChecking("Check cache");
descriptor.setIdentityMapSize(100);
descriptor.setSequenceNumberName("ENT_ENT_U1M_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_ENT_U1M_MAP_HOLDER.ID");
descriptor.addMapping(directtofieldmapping);
UnidirectionalOneToManyMapping mapMapping = new UnidirectionalOneToManyMapping();
mapMapping.setAttributeName("entityToEntityMap");
mapMapping.setReferenceClass(EntityMapValue.class);
mapMapping.setIndirectionPolicy(new TransparentIndirectionPolicy());
mapMapping.setGetMethodName("getEntityToEntityMap");
mapMapping.setSetMethodName("setEntityToEntityMap");
mapMapping.addTargetForeignKeyFieldName("ENT_MAP_VALUE.HOLDER_ID", "ENT_ENT_U1M_MAP_HOLDER.ID");
org.eclipse.persistence.mappings.OneToOneMapping keyMapping = new org.eclipse.persistence.mappings.OneToOneMapping();
keyMapping.setReferenceClass(EntityMapKey.class);
keyMapping.addForeignKeyFieldName("ENT_MAP_VALUE.KEY_ID", "ENT_MAP_KEY.ID");
keyMapping.dontUseIndirection();
keyMapping.setDescriptor(descriptor);
MappedKeyMapContainerPolicy policy = new MappedKeyMapContainerPolicy(IndirectMap.class);
policy.setKeyMapping(keyMapping);
policy.setValueMapping(mapMapping);
mapMapping.setContainerPolicy(policy);
descriptor.addMapping(mapMapping);
addDescriptor(descriptor);
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class MapCollectionsProject method buildDirectEntityMapHolderDescriptor.
protected void buildDirectEntityMapHolderDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(DirectEntityMapHolder.class);
Vector vector = new Vector();
vector.addElement("DIR_ENT_MAP_HOLDER");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("DIR_ENT_MAP_HOLDER.ID");
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
descriptor.setExistenceChecking("Check cache");
descriptor.setIdentityMapSize(100);
descriptor.setSequenceNumberName("DIR_ENT_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_ENT_MAP_HOLDER.ID");
descriptor.addMapping(directtofieldmapping);
ManyToManyMapping mapMapping = new ManyToManyMapping();
mapMapping.setAttributeName("directToEntityMap");
mapMapping.setIndirectionPolicy(new TransparentIndirectionPolicy());
mapMapping.setReferenceClass(EntityMapValue.class);
mapMapping.setRelationTableName("DIR_ENT_MAP_REL");
mapMapping.setGetMethodName("getDirectToEntityMap");
mapMapping.setSetMethodName("setDirectToEntityMap");
mapMapping.addSourceRelationKeyFieldName("DIR_ENT_MAP_REL.HOLDER_ID", "DIR_ENT_MAP_HOLDER.ID");
mapMapping.addTargetRelationKeyFieldName("DIR_ENT_MAP_REL.VALUE_ID", "ENT_MAP_VALUE.ID");
org.eclipse.persistence.mappings.DirectToFieldMapping keyMapping = new org.eclipse.persistence.mappings.DirectToFieldMapping();
keyMapping.setFieldName("DIR_ENT_MAP_REL.MAP_KEY");
keyMapping.setAttributeClassification(Integer.class);
keyMapping.setDescriptor(descriptor);
MappedKeyMapContainerPolicy policy = new MappedKeyMapContainerPolicy(IndirectMap.class);
policy.setKeyMapping(keyMapping);
policy.setValueMapping(mapMapping);
mapMapping.setContainerPolicy(policy);
descriptor.addMapping(mapMapping);
addDescriptor(descriptor);
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class MapCollectionsProject method buildDirectEntityU1MMapHolderDescriptor.
protected void buildDirectEntityU1MMapHolderDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(DirectEntityU1MMapHolder.class);
Vector vector = new Vector();
vector.addElement("DIR_ENT_U1M_MAP_HOLDER");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("DIR_ENT_U1M_MAP_HOLDER.ID");
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
descriptor.setExistenceChecking("Check cache");
descriptor.setIdentityMapSize(100);
descriptor.setSequenceNumberName("DIR_ENT_U1M_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_ENT_U1M_MAP_HOLDER.ID");
descriptor.addMapping(directtofieldmapping);
UnidirectionalOneToManyMapping mapMapping = new UnidirectionalOneToManyMapping();
mapMapping.setAttributeName("directToEntityMap");
mapMapping.setReferenceClass(EntityMapValue.class);
mapMapping.setIndirectionPolicy(new TransparentIndirectionPolicy());
mapMapping.setGetMethodName("getDirectToEntityMap");
mapMapping.setSetMethodName("setDirectToEntityMap");
mapMapping.addTargetForeignKeyFieldName("ENT_MAP_VALUE.HOLDER_ID", "DIR_ENT_U1M_MAP_HOLDER.ID");
org.eclipse.persistence.mappings.DirectToFieldMapping keyMapping = new org.eclipse.persistence.mappings.DirectToFieldMapping();
keyMapping.setFieldName("ENT_MAP_VALUE.MAP_KEY");
keyMapping.setAttributeClassification(Integer.class);
keyMapping.setDescriptor(descriptor);
MappedKeyMapContainerPolicy policy = new MappedKeyMapContainerPolicy(IndirectMap.class);
policy.setKeyMapping(keyMapping);
policy.setValueMapping(mapMapping);
mapMapping.setContainerPolicy(policy);
descriptor.addMapping(mapMapping);
addDescriptor(descriptor);
}
Aggregations