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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations