Search in sources :

Example 16 with RelationalDescriptor

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

Example 17 with RelationalDescriptor

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

Example 18 with RelationalDescriptor

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

Example 19 with RelationalDescriptor

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

Example 20 with RelationalDescriptor

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