Search in sources :

Example 21 with RelationalDescriptor

use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.

the class InsuranceProject method buildVehicleClaimDescriptor.

public RelationalDescriptor buildVehicleClaimDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(org.eclipse.persistence.testing.models.insurance.VehicleClaim.class);
    descriptor.addTableName("VHCL_CLM");
    // Inheritance properties.
    descriptor.getDescriptorInheritancePolicy().setParentClass(org.eclipse.persistence.testing.models.insurance.Claim.class);
    // RelationalDescriptor properties.
    // Query manager.
    descriptor.getDescriptorQueryManager().checkDatabaseForDoesExist();
    // Event manager.
    // Mappings.
    DirectToFieldMapping partMapping = new DirectToFieldMapping();
    partMapping.setAttributeName("part");
    partMapping.setGetMethodName("getPart");
    partMapping.setSetMethodName("setPart");
    partMapping.setFieldName("VHCL_CLM.PART");
    descriptor.addMapping(partMapping);
    DirectToFieldMapping partDescriptionMapping = new DirectToFieldMapping();
    partDescriptionMapping.setAttributeName("partDescription");
    partDescriptionMapping.setGetMethodName("getPartDescription");
    partDescriptionMapping.setSetMethodName("setPartDescription");
    partDescriptionMapping.setFieldName("VHCL_CLM.PART_DESC");
    descriptor.addMapping(partDescriptionMapping);
    return descriptor;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor)

Example 22 with RelationalDescriptor

use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.

the class InsuranceProject method buildHealthPolicyDescriptor.

public RelationalDescriptor buildHealthPolicyDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(org.eclipse.persistence.testing.models.insurance.HealthPolicy.class);
    descriptor.addTableName("POLICY");
    // Inheritance properties.
    descriptor.getDescriptorInheritancePolicy().setParentClass(org.eclipse.persistence.testing.models.insurance.Policy.class);
    // RelationalDescriptor properties.
    // Query manager.
    descriptor.getDescriptorQueryManager().checkDatabaseForDoesExist();
    // Event manager.
    // Mappings.
    DirectToFieldMapping coverageRateMapping = new DirectToFieldMapping();
    coverageRateMapping.setAttributeName("coverageRate");
    coverageRateMapping.setGetMethodName("getCoverageRate");
    coverageRateMapping.setSetMethodName("setCoverageRate");
    coverageRateMapping.setFieldName("POLICY.COV_RATE");
    descriptor.addMapping(coverageRateMapping);
    return descriptor;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor)

Example 23 with RelationalDescriptor

use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.

the class InsuranceProject method buildHouseClaimDescriptor.

public RelationalDescriptor buildHouseClaimDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(org.eclipse.persistence.testing.models.insurance.HouseClaim.class);
    descriptor.addTableName("CLAIM");
    // Inheritance properties.
    descriptor.getDescriptorInheritancePolicy().setParentClass(org.eclipse.persistence.testing.models.insurance.Claim.class);
    // RelationalDescriptor properties.
    // Query manager.
    descriptor.getDescriptorQueryManager().checkDatabaseForDoesExist();
    // Event manager.
    // Mappings.
    DirectToFieldMapping areaMapping = new DirectToFieldMapping();
    areaMapping.setAttributeName("area");
    areaMapping.setGetMethodName("getArea");
    areaMapping.setSetMethodName("setArea");
    areaMapping.setFieldName("CLAIM.AREA");
    descriptor.addMapping(areaMapping);
    return descriptor;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor)

Example 24 with RelationalDescriptor

use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.

the class InsuranceProject method buildAddressDescriptor.

public RelationalDescriptor buildAddressDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(org.eclipse.persistence.testing.models.insurance.Address.class);
    descriptor.addTableName("INS_ADDR");
    descriptor.addPrimaryKeyFieldName("INS_ADDR.SSN");
    // Mappings.
    DirectToFieldMapping cityMapping = new DirectToFieldMapping();
    cityMapping.setAttributeName("city");
    cityMapping.setGetMethodName("getCity");
    cityMapping.setSetMethodName("setCity");
    cityMapping.setFieldName("INS_ADDR.CITY");
    descriptor.addMapping(cityMapping);
    DirectToFieldMapping countryMapping = new DirectToFieldMapping();
    countryMapping.setAttributeName("country");
    countryMapping.setGetMethodName("getCountry");
    countryMapping.setSetMethodName("setCountry");
    countryMapping.setFieldName("INS_ADDR.COUNTRY");
    descriptor.addMapping(countryMapping);
    DirectToFieldMapping stateMapping = new DirectToFieldMapping();
    stateMapping.setAttributeName("state");
    stateMapping.setGetMethodName("getState");
    stateMapping.setSetMethodName("setState");
    stateMapping.setFieldName("INS_ADDR.STATE");
    descriptor.addMapping(stateMapping);
    DirectToFieldMapping streetMapping = new DirectToFieldMapping();
    streetMapping.setAttributeName("street");
    streetMapping.setGetMethodName("getStreet");
    streetMapping.setSetMethodName("setStreet");
    streetMapping.setFieldName("INS_ADDR.STREET");
    descriptor.addMapping(streetMapping);
    DirectToFieldMapping zipCodeMapping = new DirectToFieldMapping();
    zipCodeMapping.setAttributeName("zipCode");
    zipCodeMapping.setGetMethodName("getZipCode");
    zipCodeMapping.setSetMethodName("setZipCode");
    zipCodeMapping.setFieldName("INS_ADDR.ZIPCODE");
    descriptor.addMapping(zipCodeMapping);
    OneToOneMapping policyHolderMapping = new OneToOneMapping();
    policyHolderMapping.setAttributeName("policyHolder");
    policyHolderMapping.setGetMethodName("getPolicyHolder");
    policyHolderMapping.setSetMethodName("setPolicyHolder");
    policyHolderMapping.setReferenceClass(org.eclipse.persistence.testing.models.insurance.PolicyHolder.class);
    policyHolderMapping.dontUseIndirection();
    policyHolderMapping.addForeignKeyFieldName("INS_ADDR.SSN", "HOLDER.SSN");
    descriptor.addMapping(policyHolderMapping);
    return descriptor;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor)

Example 25 with RelationalDescriptor

use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.

the class InsuranceProject method buildHousePolicyDescriptor.

public RelationalDescriptor buildHousePolicyDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(org.eclipse.persistence.testing.models.insurance.HousePolicy.class);
    descriptor.addTableName("POLICY");
    // Inheritance properties.
    descriptor.getDescriptorInheritancePolicy().setParentClass(org.eclipse.persistence.testing.models.insurance.Policy.class);
    // RelationalDescriptor properties.
    // Query manager.
    descriptor.getDescriptorQueryManager().checkDatabaseForDoesExist();
    // Event manager.
    // Mappings.
    DirectToFieldMapping dateOfConstructionMapping = new DirectToFieldMapping();
    dateOfConstructionMapping.setAttributeName("dateOfConstruction");
    dateOfConstructionMapping.setGetMethodName("getDateOfConstruction");
    dateOfConstructionMapping.setSetMethodName("setDateOfConstruction");
    dateOfConstructionMapping.setFieldName("POLICY.CNST_DTE");
    descriptor.addMapping(dateOfConstructionMapping);
    return descriptor;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor)

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