Search in sources :

Example 6 with RelationalDescriptor

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);
}
Also used : DirectToFieldMapping(org.eclipse.persistence.mappings.DirectToFieldMapping) RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor) Vector(java.util.Vector) OneToOneMapping(org.eclipse.persistence.mappings.OneToOneMapping)

Example 7 with RelationalDescriptor

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);
}
Also used : DirectToFieldMapping(org.eclipse.persistence.mappings.DirectToFieldMapping) RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor) Vector(java.util.Vector)

Example 8 with RelationalDescriptor

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);
}
Also used : DirectToFieldMapping(org.eclipse.persistence.mappings.DirectToFieldMapping) RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor) Vector(java.util.Vector) OneToOneMapping(org.eclipse.persistence.mappings.OneToOneMapping)

Example 9 with RelationalDescriptor

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;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor)

Example 10 with RelationalDescriptor

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);
}
Also used : DirectToFieldMapping(org.eclipse.persistence.mappings.DirectToFieldMapping) RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor) Vector(java.util.Vector) OneToOneMapping(org.eclipse.persistence.mappings.OneToOneMapping)

Aggregations

RelationalDescriptor (org.eclipse.persistence.descriptors.RelationalDescriptor)306 DirectToFieldMapping (org.eclipse.persistence.mappings.DirectToFieldMapping)122 OneToOneMapping (org.eclipse.persistence.mappings.OneToOneMapping)43 EclipseLinkException (org.eclipse.persistence.exceptions.EclipseLinkException)26 DescriptorException (org.eclipse.persistence.exceptions.DescriptorException)19 OneToManyMapping (org.eclipse.persistence.mappings.OneToManyMapping)18 Vector (java.util.Vector)17 TransparentIndirectionPolicy (org.eclipse.persistence.internal.indirection.TransparentIndirectionPolicy)15 MappedKeyMapContainerPolicy (org.eclipse.persistence.internal.queries.MappedKeyMapContainerPolicy)15 TransformationMapping (org.eclipse.persistence.mappings.TransformationMapping)13 IntegrityChecker (org.eclipse.persistence.exceptions.IntegrityChecker)12 ManyToManyMapping (org.eclipse.persistence.mappings.ManyToManyMapping)10 java.util (java.util)9 AggregateObjectMapping (org.eclipse.persistence.mappings.AggregateObjectMapping)8 org.eclipse.persistence.mappings (org.eclipse.persistence.mappings)7 UnidirectionalOneToManyMapping (org.eclipse.persistence.mappings.UnidirectionalOneToManyMapping)6 ObjectTypeConverter (org.eclipse.persistence.mappings.converters.ObjectTypeConverter)6 DatabaseRecord (org.eclipse.persistence.sessions.DatabaseRecord)6 DirectCollectionMapping (org.eclipse.persistence.mappings.DirectCollectionMapping)5 DirectMapMapping (org.eclipse.persistence.mappings.DirectMapMapping)4