use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class Phone method descriptor.
public static RelationalDescriptor descriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
/* First define the class, table and descriptor properties. */
descriptor.setJavaClass(org.eclipse.persistence.testing.models.events.Phone.class);
descriptor.setTableName("EPHONE");
descriptor.setPrimaryKeyFieldName("ID");
descriptor.setSequenceNumberName("SEQ");
descriptor.setSequenceNumberFieldName("ID");
/* Next define the attribute mappings. */
descriptor.addDirectMapping("id", "ID");
descriptor.addDirectMapping("phoneNo", "DESCR");
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class FUVLProject method buildAddressTLIODescriptor.
public RelationalDescriptor buildAddressTLIODescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.models.forceupdate.AddressTLIO.class);
descriptor.addTableName("ADDRESSTLIO");
descriptor.addPrimaryKeyFieldName("ADDRESSTLIO.ADDRESS_ID");
// RelationalDescriptor properties.
descriptor.useSoftCacheWeakIdentityMap();
descriptor.setIdentityMapSize(100);
descriptor.setSequenceNumberFieldName("ADDRESSTLIO.ADDRESS_ID");
descriptor.setSequenceNumberName("ADDRTLIO");
descriptor.useTimestampLocking("VERSION", false);
// Query manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setFieldName("ADDRESSTLIO.ADDRESS_ID");
descriptor.addMapping(idMapping);
DirectToFieldMapping streetMapping = new DirectToFieldMapping();
streetMapping.setAttributeName("street");
streetMapping.setFieldName("ADDRESSTLIO.STREET");
descriptor.addMapping(streetMapping);
DirectToFieldMapping cityMapping = new DirectToFieldMapping();
cityMapping.setAttributeName("city");
cityMapping.setFieldName("ADDRESSTLIO.CITY");
descriptor.addMapping(cityMapping);
DirectToFieldMapping provinceMapping = new DirectToFieldMapping();
provinceMapping.setAttributeName("province");
provinceMapping.setFieldName("ADDRESSTLIO.PROVINCE");
descriptor.addMapping(provinceMapping);
DirectToFieldMapping postalCodeMapping = new DirectToFieldMapping();
postalCodeMapping.setAttributeName("postalCode");
postalCodeMapping.setFieldName("ADDRESSTLIO.P_CODE");
descriptor.addMapping(postalCodeMapping);
DirectToFieldMapping countryMapping = new DirectToFieldMapping();
countryMapping.setAttributeName("country");
countryMapping.setFieldName("ADDRESSTLIO.COUNTRY");
descriptor.addMapping(countryMapping);
DirectToFieldMapping versionMapping = new DirectToFieldMapping();
versionMapping.setAttributeName("version");
versionMapping.setFieldName("ADDRESSTLIO.VERSION");
descriptor.addMapping(versionMapping);
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class FUVLProject method buildEmployeeVLICDescriptor.
public RelationalDescriptor buildEmployeeVLICDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.models.forceupdate.EmployeeVLIC.class);
descriptor.addTableName("EMPLOYEEVLIC");
descriptor.addPrimaryKeyFieldName("EMPLOYEEVLIC.EMP_ID");
// RelationalDescriptor properties.
descriptor.useSoftCacheWeakIdentityMap();
descriptor.setIdentityMapSize(100);
descriptor.setSequenceNumberFieldName("EMPLOYEEVLIC.EMP_ID");
descriptor.setSequenceNumberName("EMPVLIC_SEQ");
descriptor.useVersionLocking("VERSION");
// Query manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setFieldName("EMPLOYEEVLIC.EMP_ID");
descriptor.addMapping(idMapping);
DirectToFieldMapping firstNameMapping = new DirectToFieldMapping();
firstNameMapping.setAttributeName("firstName");
firstNameMapping.setFieldName("EMPLOYEEVLIC.F_NAME");
descriptor.addMapping(firstNameMapping);
DirectToFieldMapping lastNameMapping = new DirectToFieldMapping();
lastNameMapping.setAttributeName("lastName");
lastNameMapping.setFieldName("EMPLOYEEVLIC.L_NAME");
descriptor.addMapping(lastNameMapping);
DirectToFieldMapping genderMapping = new DirectToFieldMapping();
genderMapping.setAttributeName("gender");
genderMapping.setFieldName("EMPLOYEEVLIC.GENDER");
descriptor.addMapping(genderMapping);
DirectToFieldMapping salaryMapping = new DirectToFieldMapping();
salaryMapping.setAttributeName("salary");
salaryMapping.setFieldName("EMPLOYEEVLIC.SALARY");
descriptor.addMapping(salaryMapping);
OneToOneMapping addressMapping = new OneToOneMapping();
addressMapping.setAttributeName("address");
addressMapping.setReferenceClass(org.eclipse.persistence.testing.models.forceupdate.AddressVLIC.class);
addressMapping.useBasicIndirection();
addressMapping.addForeignKeyFieldName("EMPLOYEEVLIC.ADDR_ID", "ADDRESSVLIC.ADDRESS_ID");
descriptor.addMapping(addressMapping);
OneToManyMapping phoneNumbersMapping = new OneToManyMapping();
phoneNumbersMapping.setAttributeName("phoneNumbers");
phoneNumbersMapping.setReferenceClass(org.eclipse.persistence.testing.models.forceupdate.PhoneNumberVLIC.class);
phoneNumbersMapping.useBasicIndirection();
phoneNumbersMapping.addTargetForeignKeyFieldName("PHONEVLIC.EMP_ID", "EMPLOYEEVLIC.EMP_ID");
descriptor.addMapping(phoneNumbersMapping);
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class FUVLProject method buildEmployeeVLIODescriptor.
public RelationalDescriptor buildEmployeeVLIODescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.models.forceupdate.EmployeeVLIO.class);
descriptor.addTableName("EMPLOYEEVLIO");
descriptor.addPrimaryKeyFieldName("EMPLOYEEVLIO.EMP_ID");
// RelationalDescriptor properties.
descriptor.useSoftCacheWeakIdentityMap();
descriptor.setIdentityMapSize(100);
descriptor.setSequenceNumberFieldName("EMPLOYEEVLIO.EMP_ID");
descriptor.setSequenceNumberName("EMPVLIO_SEQ");
descriptor.useVersionLocking("VERSION", false);
// Query manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping idMapping = new DirectToFieldMapping();
idMapping.setAttributeName("id");
idMapping.setFieldName("EMPLOYEEVLIO.EMP_ID");
descriptor.addMapping(idMapping);
DirectToFieldMapping firstNameMapping = new DirectToFieldMapping();
firstNameMapping.setAttributeName("firstName");
firstNameMapping.setFieldName("EMPLOYEEVLIO.F_NAME");
descriptor.addMapping(firstNameMapping);
DirectToFieldMapping lastNameMapping = new DirectToFieldMapping();
lastNameMapping.setAttributeName("lastName");
lastNameMapping.setFieldName("EMPLOYEEVLIO.L_NAME");
descriptor.addMapping(lastNameMapping);
DirectToFieldMapping genderMapping = new DirectToFieldMapping();
genderMapping.setAttributeName("gender");
genderMapping.setFieldName("EMPLOYEEVLIO.GENDER");
descriptor.addMapping(genderMapping);
DirectToFieldMapping versionMapping = new DirectToFieldMapping();
versionMapping.setAttributeName("version");
versionMapping.setFieldName("EMPLOYEEVLIO.VERSION");
descriptor.addMapping(versionMapping);
DirectToFieldMapping salaryMapping = new DirectToFieldMapping();
salaryMapping.setAttributeName("salary");
salaryMapping.setFieldName("EMPLOYEEVLIO.SALARY");
descriptor.addMapping(salaryMapping);
OneToOneMapping addressMapping = new OneToOneMapping();
addressMapping.setAttributeName("address");
addressMapping.setReferenceClass(org.eclipse.persistence.testing.models.forceupdate.AddressVLIO.class);
addressMapping.useBasicIndirection();
addressMapping.addForeignKeyFieldName("EMPLOYEEVLIO.ADDR_ID", "ADDRESSVLIO.ADDRESS_ID");
descriptor.addMapping(addressMapping);
OneToManyMapping phoneNumbersMapping = new OneToManyMapping();
phoneNumbersMapping.setAttributeName("phoneNumbers");
phoneNumbersMapping.setReferenceClass(org.eclipse.persistence.testing.models.forceupdate.PhoneNumberVLIO.class);
phoneNumbersMapping.useBasicIndirection();
phoneNumbersMapping.addTargetForeignKeyFieldName("PHONEVLIO.EMP_ID", "EMPLOYEEVLIO.EMP_ID");
descriptor.addMapping(phoneNumbersMapping);
return descriptor;
}
use of org.eclipse.persistence.descriptors.RelationalDescriptor in project eclipselink by eclipse-ee4j.
the class FUVLProject method buildPhoneNumberTLICDescriptor.
public RelationalDescriptor buildPhoneNumberTLICDescriptor() {
RelationalDescriptor descriptor = new RelationalDescriptor();
descriptor.setJavaClass(org.eclipse.persistence.testing.models.forceupdate.PhoneNumberTLIC.class);
descriptor.addTableName("PHONETLIC");
descriptor.addPrimaryKeyFieldName("PHONETLIC.EMP_ID");
descriptor.addPrimaryKeyFieldName("PHONETLIC.TYPE");
// RelationalDescriptor properties.
descriptor.useSoftCacheWeakIdentityMap();
descriptor.setIdentityMapSize(100);
// Query manager.
descriptor.getQueryManager().checkCacheForDoesExist();
// Named Queries
// Event manager.
// Mappings.
DirectToFieldMapping areaCodeMapping = new DirectToFieldMapping();
areaCodeMapping.setAttributeName("areaCode");
areaCodeMapping.setFieldName("PHONETLIC.AREA_CODE");
descriptor.addMapping(areaCodeMapping);
DirectToFieldMapping numberMapping = new DirectToFieldMapping();
numberMapping.setAttributeName("number");
numberMapping.setFieldName("PHONETLIC.P_NUMBER");
descriptor.addMapping(numberMapping);
DirectToFieldMapping typeMapping = new DirectToFieldMapping();
typeMapping.setAttributeName("type");
typeMapping.setFieldName("PHONETLIC.TYPE");
descriptor.addMapping(typeMapping);
OneToOneMapping ownerMapping = new OneToOneMapping();
ownerMapping.setAttributeName("owner");
ownerMapping.setReferenceClass(org.eclipse.persistence.testing.models.forceupdate.EmployeeTLIC.class);
ownerMapping.useBasicIndirection();
ownerMapping.addForeignKeyFieldName("PHONETLIC.EMP_ID", "EMPLOYEETLIC.EMP_ID");
descriptor.addMapping(ownerMapping);
return descriptor;
}
Aggregations