protected void buildAggregateAggregateMapHolderDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

    // SECTION: DESCRIPTOR
    descriptor.setJavaClass(AggregateAggregateMapHolder.class);
    Vector vector = new Vector();
    vector.addElement("AGG_AGG_MAP_HOLDER");
    descriptor.setTableNames(vector);
    descriptor.addPrimaryKeyFieldName("AGG_AGG_MAP_HOLDER.ID");

    // SECTION: PROPERTIES
    descriptor.setIdentityMapClass(
        org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
    descriptor.setExistenceChecking("Check cache");
    descriptor.setIdentityMapSize(100);
    descriptor.setSequenceNumberName("AGG_AGG_MAP_HOLDER_ID");
    descriptor.setSequenceNumberFieldName("ID");

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping.setAttributeName("id");
    directtofieldmapping.setIsReadOnly(false);
    directtofieldmapping.setGetMethodName("getId");
    directtofieldmapping.setSetMethodName("setId");
    directtofieldmapping.setFieldName("AGG_AGG_MAP_HOLDER.ID");
    descriptor.addMapping(directtofieldmapping);

    // SECTION: AGGREGATECOLLECTIONMAPPING
    org.eclipse.persistence.mappings.AggregateCollectionMapping aggregatecollectionmapping =
        new org.eclipse.persistence.mappings.AggregateCollectionMapping();
    aggregatecollectionmapping.setAttributeName("aggregateToAggregateMap");
    aggregatecollectionmapping.setIndirectionPolicy(new TransparentIndirectionPolicy());
    aggregatecollectionmapping.setGetMethodName("getAggregateToAggregateMap");
    aggregatecollectionmapping.setSetMethodName("setAggregateToAggregateMap");
    aggregatecollectionmapping.setReferenceClass(AggregateMapKey.class);
    aggregatecollectionmapping.addTargetForeignKeyFieldName(
        "AGG_AGG_MAP_REL.HOLDER_ID", "AGG_AGG_MAP_HOLDER.ID");
    aggregatecollectionmapping.addFieldNameTranslation("AGG_AGG_MAP_REL.MAP_VALUE", "key->DIRECT");

    AggregateObjectMapping keyMapping = new AggregateObjectMapping();
    keyMapping.setReferenceClass(AggregateMapKey.class);
    keyMapping.addFieldNameTranslation("AGG_AGG_MAP_REL.MAP_KEY", "key->DIRECT");
    keyMapping.setDescriptor(descriptor);

    MappedKeyMapContainerPolicy policy = new MappedKeyMapContainerPolicy(IndirectMap.class);
    policy.setKeyMapping(keyMapping);
    policy.setValueMapping(aggregatecollectionmapping);
    aggregatecollectionmapping.setContainerPolicy(policy);

    descriptor.addMapping(aggregatecollectionmapping);

    addDescriptor(descriptor);
  }
  public ClassDescriptor buildEmployeeDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(Employee.class);
    descriptor.addTableName("EMPLOYEE");
    descriptor.addPrimaryKeyFieldName("EMPLOYEE.EMP_ID");

    // Descriptor Properties.
    descriptor.useSoftCacheWeakIdentityMap();
    descriptor.setIdentityMapSize(100);
    descriptor.setSequenceNumberFieldName("EMPLOYEE.EMP_ID");
    descriptor.setSequenceNumberName("EMP_SEQ");
    VersionLockingPolicy lockingPolicy = new VersionLockingPolicy();
    lockingPolicy.setWriteLockFieldName("EMPLOYEE.VERSION");
    lockingPolicy.storeInObject();
    descriptor.setOptimisticLockingPolicy(lockingPolicy);
    descriptor.setAlias("Employee");

    // Mappings.
    DirectToFieldMapping firstNameMapping = new DirectToFieldMapping();
    firstNameMapping.setAttributeName("firstName");
    firstNameMapping.setFieldName("EMPLOYEE.F_NAME");
    firstNameMapping.setNullValue("");
    descriptor.addMapping(firstNameMapping);

    DirectToFieldMapping idMapping = new DirectToFieldMapping();
    idMapping.setAttributeName("id");
    idMapping.setFieldName("EMPLOYEE.EMP_ID");
    descriptor.addMapping(idMapping);

    DirectToFieldMapping versionMapping = new DirectToFieldMapping();
    versionMapping.setAttributeName("version");
    versionMapping.setFieldName("EMPLOYEE.VERSION");
    descriptor.addMapping(versionMapping);

    DirectToFieldMapping lastNameMapping = new DirectToFieldMapping();
    lastNameMapping.setAttributeName("lastName");
    lastNameMapping.setFieldName("EMPLOYEE.L_NAME");
    lastNameMapping.setNullValue("");
    descriptor.addMapping(lastNameMapping);

    DirectToFieldMapping salaryMapping = new DirectToFieldMapping();
    salaryMapping.setAttributeName("salary");
    salaryMapping.setFieldName("EMPLOYEE.SALARY");
    descriptor.addMapping(salaryMapping);

    DirectToFieldMapping genderMapping = new DirectToFieldMapping();
    genderMapping.setAttributeName("gender");
    genderMapping.setFieldName("EMPLOYEE.GENDER");
    descriptor.addMapping(genderMapping);

    AggregateObjectMapping periodMapping = new AggregateObjectMapping();
    periodMapping.setAttributeName("period");
    periodMapping.setReferenceClass(
        org.eclipse.persistence.testing.models.performance.EmploymentPeriod.class);
    periodMapping.setIsNullAllowed(true);
    periodMapping.addFieldNameTranslation("EMPLOYEE.END_DATE", "endDate->DIRECT");
    periodMapping.addFieldNameTranslation("EMPLOYEE.START_DATE", "startDate->DIRECT");
    descriptor.addMapping(periodMapping);

    OneToOneMapping addressMapping = new OneToOneMapping();
    addressMapping.setAttributeName("address");
    addressMapping.setGetMethodName("getAddressHolder");
    addressMapping.setSetMethodName("setAddressHolder");
    addressMapping.setReferenceClass(
        org.eclipse.persistence.testing.models.performance.Address.class);
    addressMapping.useBasicIndirection();
    addressMapping.privateOwnedRelationship();
    addressMapping.addForeignKeyFieldName("EMPLOYEE.ADDR_ID", "ADDRESS.ADDRESS_ID");
    descriptor.addMapping(addressMapping);

    OneToOneMapping managerMapping = new OneToOneMapping();
    managerMapping.setAttributeName("manager");
    managerMapping.setGetMethodName("getManagerHolder");
    managerMapping.setSetMethodName("setManagerHolder");
    managerMapping.setReferenceClass(Employee.class);
    managerMapping.useBasicIndirection();
    managerMapping.addForeignKeyFieldName("EMPLOYEE.MANAGER_ID", "EMPLOYEE.EMP_ID");
    descriptor.addMapping(managerMapping);

    OneToManyMapping managedEmployeesMapping = new OneToManyMapping();
    managedEmployeesMapping.setAttributeName("managedEmployees");
    managedEmployeesMapping.setReferenceClass(Employee.class);
    managedEmployeesMapping.useTransparentSet();
    managedEmployeesMapping.addTargetForeignKeyFieldName("EMPLOYEE.MANAGER_ID", "EMPLOYEE.EMP_ID");
    descriptor.addMapping(managedEmployeesMapping);

    OneToManyMapping phoneNumbersMapping = new OneToManyMapping();
    phoneNumbersMapping.setAttributeName("phoneNumbers");
    phoneNumbersMapping.setReferenceClass(PhoneNumber.class);
    phoneNumbersMapping.useTransparentSet();
    phoneNumbersMapping.privateOwnedRelationship();
    phoneNumbersMapping.addTargetForeignKeyFieldName("PHONE.EMP_ID", "EMPLOYEE.EMP_ID");
    descriptor.addMapping(phoneNumbersMapping);

    ManyToManyMapping projectsMapping = new ManyToManyMapping();
    projectsMapping.setAttributeName("projects");
    projectsMapping.setReferenceClass(Project.class);
    projectsMapping.useTransparentSet();
    projectsMapping.setRelationTableName("PROJ_EMP");
    projectsMapping.addSourceRelationKeyFieldName("PROJ_EMP.EMP_ID", "EMPLOYEE.EMP_ID");
    projectsMapping.addTargetRelationKeyFieldName("PROJ_EMP.PROJ_ID", "PROJECT.PROJ_ID");
    descriptor.addMapping(projectsMapping);

    return descriptor;
  }
  public static RelationalDescriptor descriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

    /* First define the class, table and descriptor properties. */
    descriptor.setJavaClass(Customer.class);
    descriptor.setTableName("EVENTCUSTOMER");
    descriptor.setPrimaryKeyFieldName("ID");
    descriptor.setSequenceNumberName("SEQ");
    descriptor.setSequenceNumberFieldName("ID");

    /* Next define the attribute mappings. */
    OneToOneMapping addressMapping = new OneToOneMapping();
    addressMapping.setAttributeName("address");
    addressMapping.setReferenceClass(Address.class);
    addressMapping.dontUseIndirection();
    addressMapping.privateOwnedRelationship();
    addressMapping.addForeignKeyFieldName("EVENTCUSTOMER.ADDRESS_ID", "EADDRESS.ID");
    descriptor.addMapping(addressMapping);

    OneToOneMapping phoneMapping = new OneToOneMapping();
    phoneMapping.setAttributeName("phoneNumber");
    phoneMapping.setReferenceClass(Phone.class);
    phoneMapping.dontUseIndirection();
    phoneMapping.privateOwnedRelationship();
    phoneMapping.addForeignKeyFieldName("EVENTCUSTOMER.PHONE_ID", "EPHONE.ID");
    descriptor.addMapping(phoneMapping);

    OneToOneMapping emailMapping = new OneToOneMapping();
    emailMapping.setAttributeName("email");
    emailMapping.setReferenceClass(EmailAccount.class);
    emailMapping.dontUseIndirection();
    emailMapping.privateOwnedRelationship();
    emailMapping.addForeignKeyFieldName("EVENTCUSTOMER.EMAIL_ID", "EMAILACC.ID");
    descriptor.addMapping(emailMapping);

    DirectCollectionMapping associationsMapping = new DirectCollectionMapping();
    associationsMapping.setAttributeName("associations");
    associationsMapping.dontUseIndirection();
    associationsMapping.setReferenceTableName("EASSOCIATIONS");
    associationsMapping.setDirectFieldName("EASSOCIATIONS.DESCRIP");
    associationsMapping.addReferenceKeyFieldName("EASSOCIATIONS.CUSTOMER_ID", "EVENTCUSTOMER.ID");
    descriptor.addMapping(associationsMapping);

    OneToManyMapping ordersMapping = new OneToManyMapping();
    ordersMapping.setAttributeName("orders");
    ordersMapping.setReferenceClass(Order.class);
    ordersMapping.useBasicIndirection();
    ordersMapping.addTargetForeignKeyFieldName("EVENTORDER.CUSTOMER_ID", "EVENTCUSTOMER.ID");
    descriptor.addMapping(ordersMapping);

    AggregateObjectMapping creditMapping = new AggregateObjectMapping();
    creditMapping.setAttributeName("creditCard");
    creditMapping.setReferenceClass(org.eclipse.persistence.testing.models.events.CreditCard.class);
    creditMapping.setIsNullAllowed(true);
    descriptor.addMapping(creditMapping);

    descriptor.addDirectMapping("id", "ID");
    descriptor.addDirectMapping("name", "NAME");

    return descriptor;
  }
  /**
   * TopLink generated method. <b>WARNING</b>: This code was generated by an automated tool. Any
   * changes will be lost when the code is re-generated
   */
  protected void buildMovieDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

    // SECTION: DESCRIPTOR
    descriptor.setJavaClass(org.eclipse.persistence.testing.models.readonly.Movie.class);
    Vector vector = new Vector();
    vector.addElement("RO_MOVIE");
    descriptor.setTableNames(vector);
    descriptor.addPrimaryKeyFieldName("RO_MOVIE.MOV_ID");

    // SECTION: PROPERTIES
    descriptor.setIdentityMapClass(
        org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
    descriptor.setSequenceNumberName("MOV_SEQ");
    descriptor.setSequenceNumberFieldName("MOV_ID");
    descriptor.setExistenceChecking("Check cache");
    descriptor.setIdentityMapSize(100);

    // SECTION: COPY POLICY
    descriptor.createCopyPolicy("constructor");

    // SECTION: INSTANTIATION POLICY
    descriptor.createInstantiationPolicy("constructor");

    // SECTION: AGGREGATEOBJECTMAPPING
    org.eclipse.persistence.mappings.AggregateObjectMapping aggregateobjectmapping =
        new org.eclipse.persistence.mappings.AggregateObjectMapping();
    aggregateobjectmapping.setAttributeName("studio");
    aggregateobjectmapping.setIsReadOnly(true);
    aggregateobjectmapping.setReferenceClass(
        org.eclipse.persistence.testing.models.readonly.Studio.class);
    aggregateobjectmapping.setIsNullAllowed(false);
    descriptor.addMapping(aggregateobjectmapping);

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping.setAttributeName("id");
    directtofieldmapping.setIsReadOnly(false);
    directtofieldmapping.setFieldName("RO_MOVIE.MOV_ID");
    descriptor.addMapping(directtofieldmapping);

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping1 =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping1.setAttributeName("title");
    directtofieldmapping1.setIsReadOnly(false);
    directtofieldmapping1.setFieldName("RO_MOVIE.TITLE");
    descriptor.addMapping(directtofieldmapping1);

    // SECTION: MANYTOMANYMAPPING
    org.eclipse.persistence.mappings.ManyToManyMapping manytomanymapping =
        new org.eclipse.persistence.mappings.ManyToManyMapping();
    manytomanymapping.setAttributeName("actors");
    manytomanymapping.setIsReadOnly(false);
    manytomanymapping.setUsesIndirection(false);
    manytomanymapping.setReferenceClass(
        org.eclipse.persistence.testing.models.readonly.Actor.class);
    manytomanymapping.setIsPrivateOwned(true);
    manytomanymapping.setRelationTableName("ACT_MOV");
    manytomanymapping.addSourceRelationKeyFieldName("ACT_MOV.MOV_ID", "RO_MOVIE.MOV_ID");
    manytomanymapping.addTargetRelationKeyFieldName("ACT_MOV.ACT_ID", "RO_ACTOR.ACT_ID");
    descriptor.addMapping(manytomanymapping);

    // SECTION: ONETOONEMAPPING
    org.eclipse.persistence.mappings.OneToOneMapping onetoonemapping =
        new org.eclipse.persistence.mappings.OneToOneMapping();
    onetoonemapping.setAttributeName("promoter");
    onetoonemapping.setIsReadOnly(false);
    onetoonemapping.setUsesIndirection(false);
    onetoonemapping.setReferenceClass(
        org.eclipse.persistence.testing.models.readonly.Promoter.class);
    onetoonemapping.setIsPrivateOwned(false);
    onetoonemapping.addForeignKeyFieldName("RO_MOVIE.PROMO_ID", "RO_PROMO.PROMO_ID");
    descriptor.addMapping(onetoonemapping);
    addDescriptor(descriptor);
  }