Search in sources :

Example 51 with RelationalDescriptor

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

the class UUIDTester method descriptorWithAccessors.

public static RelationalDescriptor descriptorWithAccessors() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    /* First define the class, table and descriptor properties. */
    descriptor.setJavaClass(UUIDTester.class);
    descriptor.setTableName("UUIDS");
    descriptor.setPrimaryKeyFieldName("NAME");
    /* Next define the attribute mappings. */
    try {
        descriptor.addDirectMapping("testName", "getTestName", "setTestName", "NAME");
        descriptor.addDirectMapping("uuidValue", "getUuidValue", "setUuidValue", "UUIDV");
    } catch (DescriptorException exception) {
    }
    return descriptor;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor) DescriptorException(org.eclipse.persistence.exceptions.DescriptorException)

Example 52 with RelationalDescriptor

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

the class UUIDTester method descriptor.

public static RelationalDescriptor descriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    /* First define the class, table and descriptor properties. */
    descriptor.setJavaClass(UUIDTester.class);
    descriptor.setTableName("UUIDS");
    descriptor.setPrimaryKeyFieldName("NAME");
    /* Next define the attribute mappings. */
    descriptor.addDirectMapping("testName", "getTestName", "setTestName", "NAME");
    descriptor.addDirectMapping("uuidValue", "UUIDV");
    return descriptor;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor)

Example 53 with RelationalDescriptor

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

the class BidirectionWithHashtableTest method descriptor.

public RelationalDescriptor descriptor() {
    RelationalDescriptor employeeDescriptor = new RelationalDescriptor();
    employeeDescriptor.setJavaClass(Employee.class);
    employeeDescriptor.setTableName("VAL_EMP");
    employeeDescriptor.setPrimaryKeyFieldName("ID");
    OneToManyMapping phoneNumbersMapping = new OneToManyMapping();
    phoneNumbersMapping.setAttributeName("phoneNumbers");
    phoneNumbersMapping.setReferenceClass(org.eclipse.persistence.testing.models.employee.domain.PhoneNumber.class);
    phoneNumbersMapping.useTransparentCollection();
    phoneNumbersMapping.useMapClass(org.eclipse.persistence.indirection.IndirectMap.class, "getNumber");
    phoneNumbersMapping.privateOwnedRelationship();
    phoneNumbersMapping.addTargetForeignKeyFieldName("PHONE.EMP_ID", "EMPLOYEE.EMP_ID");
    phoneNumbersMapping.setRelationshipPartnerAttributeName("employee");
    employeeDescriptor.addMapping(phoneNumbersMapping);
    return employeeDescriptor;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor) OneToManyMapping(org.eclipse.persistence.mappings.OneToManyMapping)

Example 54 with RelationalDescriptor

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

the class ChildDoesNotDefineAbstractQueryKeyOfParentTest method buildProjectInterfaceDescriptor.

public RelationalDescriptor buildProjectInterfaceDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(org.eclipse.persistence.testing.models.employee.interfaces.Project.class);
    descriptor.descriptorIsForInterface();
    // old
    // descriptor.addDirectQueryKey("description", "DESCRIP");
    // new
    descriptor.addAbstractQueryKey("testKey");
    return descriptor;
}
Also used : RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor)

Example 55 with RelationalDescriptor

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

the class ChildDoesNotDefineAbstractQueryKeyOfParentTest method buildTestDescriptor.

public RelationalDescriptor buildTestDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(org.eclipse.persistence.testing.models.employee.domain.Project.class);
    descriptor.addTableName("PROJECT");
    descriptor.addPrimaryKeyFieldName("PROJECT.PROJ_ID");
    descriptor.getInterfacePolicy().addParentInterface(org.eclipse.persistence.testing.models.employee.interfaces.Project.class);
    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