use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class MappingProject method buildHardwareDescriptor.
protected void buildHardwareDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(Hardware.class);
Vector vector = new Vector();
vector.addElement("MAP_HRW");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("MAP_HRW.ID");
// SECTION: PROPERTIES
descriptor.setSequenceNumberName("SEQ");
descriptor.setSequenceNumberFieldName("ID");
descriptor.getInheritancePolicy().setShouldReadSubclasses(true);
descriptor.getInheritancePolicy().setClassIndicatorFieldName("TYPE");
descriptor.getInheritancePolicy().setShouldUseClassNameAsIndicator(false);
descriptor.getInheritancePolicy().addClassIndicator(Computer.class, "C");
descriptor.getInheritancePolicy().addClassIndicator(Monitor.class, "M");
// SECTION: COPY POLICY
descriptor.createCopyPolicy("constructor");
// SECTION: INSTANTIATION POLICY
descriptor.createInstantiationPolicy("constructor");
// SECTION: DIRECTTOFIELDMAPPING
DirectToFieldMapping directtofieldmapping = new DirectToFieldMapping();
directtofieldmapping.setAttributeName("distibuted");
directtofieldmapping.setIsReadOnly(false);
directtofieldmapping.setFieldName("MAP_HRW.DIST");
descriptor.addMapping(directtofieldmapping);
// SECTION: DIRECTTOFIELDMAPPING
DirectToFieldMapping directtofieldmapping1 = new DirectToFieldMapping();
directtofieldmapping1.setAttributeName("id");
directtofieldmapping1.setIsReadOnly(false);
directtofieldmapping1.setFieldName("MAP_HRW.ID");
descriptor.addMapping(directtofieldmapping1);
// SECTION: ONETOONEMAPPING
OneToOneMapping onetoonemapping = new OneToOneMapping();
onetoonemapping.setAttributeName("employee");
onetoonemapping.setIsReadOnly(false);
onetoonemapping.setUsesIndirection(false);
onetoonemapping.setReferenceClass(Employee.class);
onetoonemapping.setIsPrivateOwned(false);
onetoonemapping.addForeignKeyFieldName("MAP_HRW.EMP_FNAME", "MAP_EMP.FNAME");
onetoonemapping.addForeignKeyFieldName("MAP_HRW.EMP_LNAME", "MAP_EMP.LNAME");
descriptor.addMapping(onetoonemapping);
addDescriptor(descriptor);
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class MappingProject method buildPhoneDescriptor.
protected void buildPhoneDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(Phone.class);
Vector vector = new Vector();
vector.addElement("MAP_PHO");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("MAP_PHO.P_ID");
// SECTION: PROPERTIES
descriptor.setSequenceNumberName("SEQ_ID");
descriptor.setSequenceNumberFieldName("P_ID");
// SECTION: COPY POLICY
descriptor.createCopyPolicy("constructor");
descriptor.useHardCacheWeakIdentityMap();
// SECTION: INSTANTIATION POLICY
descriptor.createInstantiationPolicy("constructor");
// SECTION: DIRECTTOFIELDMAPPING
DirectToFieldMapping directtofieldmapping = new DirectToFieldMapping();
directtofieldmapping.setAttributeName("areaCode");
directtofieldmapping.setIsReadOnly(false);
directtofieldmapping.setFieldName("MAP_PHO.AREACODE");
descriptor.addMapping(directtofieldmapping);
// SECTION: DIRECTTOFIELDMAPPING
DirectToFieldMapping directtofieldmapping1 = new DirectToFieldMapping();
directtofieldmapping1.setAttributeName("id");
directtofieldmapping1.setIsReadOnly(false);
directtofieldmapping1.setFieldName("MAP_PHO.P_ID");
descriptor.addMapping(directtofieldmapping1);
// SECTION: DIRECTTOFIELDMAPPING
DirectToFieldMapping directtofieldmapping2 = new DirectToFieldMapping();
directtofieldmapping2.setAttributeName("number");
directtofieldmapping2.setIsReadOnly(false);
directtofieldmapping2.setFieldName("MAP_PHO.PNUMBER");
descriptor.addMapping(directtofieldmapping2);
addDescriptor(descriptor);
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class MappingProject method buildCompanyCardDescriptor.
protected void buildCompanyCardDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(CompanyCard.class);
Vector vector = new Vector();
vector.addElement("MAP_CARD");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("MAP_CARD.COM_ID");
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(FullIdentityMap.class);
descriptor.setExistenceChecking("Check cache");
descriptor.setIdentityMapSize(100);
// SECTION: COPY POLICY
descriptor.createCopyPolicy("constructor");
// SECTION: INSTANTIATION POLICY
descriptor.createInstantiationPolicy("constructor");
// SECTION: DIRECTTOFIELDMAPPING
DirectToFieldMapping directtofieldmapping1 = new DirectToFieldMapping();
directtofieldmapping1.setAttributeName("number");
directtofieldmapping1.setIsReadOnly(false);
directtofieldmapping1.setFieldName("MAP_CARD.CARDNUMBER");
descriptor.addMapping(directtofieldmapping1);
// SECTION: DIRECTTOFIELDMAPPING
DirectToFieldMapping directtofieldmapping2 = new DirectToFieldMapping();
directtofieldmapping2.setAttributeName("limit");
directtofieldmapping2.setIsReadOnly(false);
directtofieldmapping2.setFieldName("MAP_CARD.AMOUNT_LIMIT");
descriptor.addMapping(directtofieldmapping2);
// SECTION: ONETOONEMAPPING
OneToOneMapping oneToOneMapping = new OneToOneMapping();
oneToOneMapping.setReferenceClass(Address.class);
oneToOneMapping.setAttributeName("owner");
oneToOneMapping.setIsReadOnly(false);
oneToOneMapping.addForeignKeyFieldName("MAP_CARD.COM_ID", "MAP_ADD.A_ID");
oneToOneMapping.dontUseIndirection();
descriptor.addMapping(oneToOneMapping);
addDescriptor(descriptor);
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class Budget method descriptor.
public static RelationalDescriptor descriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(Budget.class);
descriptor.setTableName("BUDGET");
descriptor.addPrimaryKeyFieldName("BUDGET.ID");
// SECTION: PROPERTIES
descriptor.setIdentityMapClass(org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
descriptor.setExistenceChecking("Check cache");
descriptor.setIdentityMapSize(100);
descriptor.setSequenceNumberName("BUDG_SEQ");
descriptor.setSequenceNumberFieldName("ID");
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping1 = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping1.setAttributeName("currency");
directtofieldmapping1.setIsReadOnly(false);
directtofieldmapping1.setFieldName("BUDGET.CUR");
descriptor.addMapping(directtofieldmapping1);
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping2 = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping2.setAttributeName("amount");
directtofieldmapping2.setIsReadOnly(false);
directtofieldmapping2.setFieldName("BUDGET.AMNT");
descriptor.addMapping(directtofieldmapping2);
// SECTION: DIRECTTOFIELDMAPPING
org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping3 = new org.eclipse.persistence.mappings.DirectToFieldMapping();
directtofieldmapping3.setAttributeName("id");
directtofieldmapping3.setIsReadOnly(false);
directtofieldmapping3.setFieldName("BUDGET.ID");
descriptor.addMapping(directtofieldmapping3);
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class MappingProject method buildSecureSystemDescriptor.
protected void buildSecureSystemDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
// SECTION: DESCRIPTOR
descriptor.setJavaClass(SecureSystem.class);
Vector vector = new Vector();
vector.addElement("MAP_SECURE");
descriptor.setTableNames(vector);
descriptor.addPrimaryKeyFieldName("MAP_SECURE.MANUFACTURER");
descriptor.addPrimaryKeyFieldName("MAP_SECURE.IDENTIFICATION_ID");
// SECTION: PROPERTIES
// SECTION: COPY POLICY
descriptor.createCopyPolicy("constructor");
// SECTION: INSTANTIATION POLICY
descriptor.createInstantiationPolicy("constructor");
// SECTION: DIRECTTOFIELDMAPPING
DirectToFieldMapping directtofieldmapping = new DirectToFieldMapping();
directtofieldmapping.setAttributeName("manufacturer");
directtofieldmapping.setIsReadOnly(false);
directtofieldmapping.setFieldName("MAP_SECURE.MANUFACTURER");
descriptor.addMapping(directtofieldmapping);
// SECTION: ONETOONEMAPPING
OneToOneMapping onetoonemapping1 = new OneToOneMapping();
onetoonemapping1.setAttributeName("id");
onetoonemapping1.setIsReadOnly(false);
onetoonemapping1.setUsesIndirection(false);
onetoonemapping1.setReferenceClass(Identification.class);
onetoonemapping1.setIsPrivateOwned(false);
onetoonemapping1.addForeignKeyFieldName("MAP_SECURE.IDENTIFICATION_ID", "MAP_IDENTIFICATION.ID");
descriptor.addMapping(onetoonemapping1);
addDescriptor(descriptor);
}
Aggregations