public ClassDescriptor buildLargeProjectDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(LargeProject.class);
    descriptor.addTableName("OTOJT_LPROJECT");

    // Inheritance Properties.
    descriptor.getInheritancePolicy().setParentClass(Project.class);
    descriptor.getInheritancePolicy().dontReadSubclassesOnQueries();

    // Descriptor Properties.
    descriptor.setAlias("OTOJT_LargeProject");

    // Cache Invalidation Policy
    // Query Manager.
    descriptor.getQueryManager().checkCacheForDoesExist();

    // Named Queries.
    // Event Manager.
    // Mappings.
    DirectToFieldMapping budgetMapping = new DirectToFieldMapping();
    budgetMapping.setAttributeName("budget");
    budgetMapping.setFieldName("OTOJT_LPROJECT.BUDGET");
    descriptor.addMapping(budgetMapping);

    DirectToFieldMapping milestoneVersionMapping = new DirectToFieldMapping();
    milestoneVersionMapping.setAttributeName("milestoneVersion");
    milestoneVersionMapping.setFieldName("OTOJT_LPROJECT.MILESTONE");
    descriptor.addMapping(milestoneVersionMapping);

    return descriptor;
  }
  /** modifications are marked with "bjv" */
  protected void buildOrderLineDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

    // SECTION: DESCRIPTOR
    descriptor.setJavaClass(orderLineClass());
    Vector vector = new Vector();
    vector.addElement("ORDLINE");
    descriptor.setTableNames(vector);
    descriptor.addPrimaryKeyFieldName("ORDLINE.ID");

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

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

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

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

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping1 =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping1.setAttributeName("itemName");
    directtofieldmapping1.setIsReadOnly(false);
    directtofieldmapping1.setFieldName("ORDLINE.ITEM_NAME");
    descriptor.addMapping(directtofieldmapping1);

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping2 =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping2.setAttributeName("quantity");
    directtofieldmapping2.setIsReadOnly(false);
    directtofieldmapping2.setFieldName("ORDLINE.QUANTITY");
    descriptor.addMapping(directtofieldmapping2);

    // SECTION: ONETOONEMAPPING
    org.eclipse.persistence.mappings.OneToOneMapping onetoonemapping =
        new org.eclipse.persistence.mappings.OneToOneMapping();
    onetoonemapping.setAttributeName("order");
    onetoonemapping.setIsReadOnly(false);
    onetoonemapping.setUsesIndirection(false);
    onetoonemapping.setReferenceClass(this.orderClass()); // bjv
    onetoonemapping.setIsPrivateOwned(false);
    onetoonemapping.addForeignKeyFieldName("ORDLINE.ORDER_ID", "ORD.ID");
    descriptor.addMapping(onetoonemapping);
    addDescriptor(descriptor);
  }
  public RelationalDescriptor descriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(
        org.eclipse.persistence.testing.tests.validation.PersonInstanceAccess.class);
    descriptor.addTableName("EMPLOYEE");
    descriptor.addPrimaryKeyFieldName("EMPLOYEE.EMP_ID");

    // Descriptor properties.
    descriptor.useSoftCacheWeakIdentityMap();
    descriptor.setIdentityMapSize(100);
    descriptor.useRemoteSoftCacheWeakIdentityMap();
    descriptor.setRemoteIdentityMapSize(100);
    descriptor.setSequenceNumberFieldName("EMP_ID");
    descriptor.setSequenceNumberName("EMP_SEQ");
    descriptor.setAlias("EMPLOYEE");

    // Query manager.
    descriptor.getQueryManager().checkCacheForDoesExist();
    // Named Queries

    // Event manager.

    // Mappings.
    DirectToFieldMapping p_idMapping = new DirectToFieldMapping();
    p_idMapping.setAttributeName("p_id");
    p_idMapping.setFieldName("EMPLOYEE.EMP_ID");
    descriptor.addMapping(p_idMapping);

    DirectToFieldMapping p_nameMapping = new DirectToFieldMapping();
    p_nameMapping.setAttributeName("p_name");
    p_nameMapping.setFieldName("EMPLOYEE.F_NAME");
    descriptor.addMapping(p_nameMapping);

    return descriptor;
  }
  protected void buildEntityAggregateMapHolderDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

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

    // SECTION: PROPERTIES
    descriptor.setIdentityMapClass(
        org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
    descriptor.setExistenceChecking("Check cache");
    descriptor.setIdentityMapSize(100);
    descriptor.setSequenceNumberName("ENT_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("ENT_AGG_MAP_HOLDER.ID");
    descriptor.addMapping(directtofieldmapping);

    // SECTION: AGGREGATECOLLECTIONMAPPING
    org.eclipse.persistence.mappings.AggregateCollectionMapping aggregatecollectionmapping =
        new org.eclipse.persistence.mappings.AggregateCollectionMapping();
    aggregatecollectionmapping.setAttributeName("entityToAggregateMap");
    aggregatecollectionmapping.setIndirectionPolicy(new TransparentIndirectionPolicy());
    aggregatecollectionmapping.setGetMethodName("getEntityToAggregateMap");
    aggregatecollectionmapping.setSetMethodName("setEntityToAggregateMap");
    aggregatecollectionmapping.setReferenceClass(AggregateMapValue.class);
    aggregatecollectionmapping.addTargetForeignKeyFieldName(
        "ENT_AGG_MAP_REL.HOLDER_ID", "ENT_AGG_MAP_HOLDER.ID");
    aggregatecollectionmapping.addFieldNameTranslation(
        "ENT_AGG_MAP_REL.MAP_VALUE", "value->DIRECT");

    org.eclipse.persistence.mappings.OneToOneMapping keyMapping =
        new org.eclipse.persistence.mappings.OneToOneMapping();
    keyMapping.setReferenceClass(EntityMapKey.class);
    keyMapping.addForeignKeyFieldName("ENT_AGG_MAP_REL.KEY_ID", "ENT_MAP_KEY.ID");
    keyMapping.dontUseIndirection();
    keyMapping.setDescriptor(descriptor);

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

    descriptor.addMapping(aggregatecollectionmapping);

    addDescriptor(descriptor);
  }
  public RelationalDescriptor buildImageDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(org.eclipse.persistence.testing.tests.lob.Image.class);
    descriptor.addTableName("IMAGE");
    descriptor.addTableName("CLIP");
    descriptor.addPrimaryKeyFieldName("IMAGE.ID");

    // Descriptor properties.
    descriptor.useSoftCacheWeakIdentityMap();
    descriptor.setIdentityMapSize(100);
    descriptor.useRemoteSoftCacheWeakIdentityMap();
    descriptor.setRemoteIdentityMapSize(100);
    descriptor.setSequenceNumberFieldName("IMAGE.ID");
    descriptor.setSequenceNumberName("image_lob_seq");
    descriptor.setAlias("Image");

    // Query manager.
    descriptor.getQueryManager().checkCacheForDoesExist();
    // Named Queries

    // Event manager.

    // Mappings.
    DirectToFieldMapping idMapping = new DirectToFieldMapping();
    idMapping.setAttributeName("id");
    idMapping.setFieldName("IMAGE.ID");
    descriptor.addMapping(idMapping);

    DirectToFieldMapping pictureMapping = new DirectToFieldMapping();
    pictureMapping.setAttributeName("picture");
    pictureMapping.setFieldName("IMAGE.PICTURE");
    pictureMapping.setFieldClassification(java.sql.Blob.class);
    descriptor.addMapping(pictureMapping);

    DirectToFieldMapping scriptMapping = new DirectToFieldMapping();
    scriptMapping.setAttributeName("script");
    scriptMapping.setFieldName("IMAGE.SCRIPT");
    scriptMapping.setFieldClassification(java.sql.Clob.class);
    descriptor.addMapping(scriptMapping);

    DirectToFieldMapping audioMapping = new DirectToFieldMapping();
    audioMapping.setAttributeName("audio");
    audioMapping.setFieldName("CLIP.AUDIO");
    audioMapping.setFieldClassification(java.sql.Blob.class);
    descriptor.addMapping(audioMapping);

    DirectToFieldMapping commentaryMapping = new DirectToFieldMapping();
    commentaryMapping.setAttributeName("commentary");
    commentaryMapping.setFieldName("CLIP.COMMENTARY");
    commentaryMapping.setFieldClassification(java.sql.Clob.class);
    descriptor.addMapping(commentaryMapping);

    return descriptor;
  }
  public ClassDescriptor buildProjectDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(Project.class);
    descriptor.addTableName("PROJECT");
    descriptor.addPrimaryKeyFieldName("PROJECT.PROJ_ID");

    // Inheritance Properties.
    descriptor.getInheritancePolicy().setClassIndicatorFieldName("PROJECT.PROJ_TYPE");
    descriptor.getInheritancePolicy().addClassIndicator(SmallProject.class, "S");
    descriptor.getInheritancePolicy().addClassIndicator(LargeProject.class, "L");

    // Descriptor Properties.
    descriptor.useSoftCacheWeakIdentityMap();
    descriptor.setIdentityMapSize(100);
    descriptor.setSequenceNumberFieldName("PROJECT.PROJ_ID");
    descriptor.setSequenceNumberName("PROJ_SEQ");
    VersionLockingPolicy lockingPolicy = new VersionLockingPolicy();
    lockingPolicy.setWriteLockFieldName("PROJECT.VERSION");
    lockingPolicy.storeInObject();
    descriptor.setOptimisticLockingPolicy(lockingPolicy);
    descriptor.setAlias("Project");

    // Mappings.
    DirectToFieldMapping descriptionMapping = new DirectToFieldMapping();
    descriptionMapping.setAttributeName("description");
    descriptionMapping.setFieldName("PROJECT.DESCRIP");
    descriptionMapping.setNullValue("");
    descriptor.addMapping(descriptionMapping);

    DirectToFieldMapping idMapping = new DirectToFieldMapping();
    idMapping.setAttributeName("id");
    idMapping.setFieldName("PROJECT.PROJ_ID");
    descriptor.addMapping(idMapping);

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

    DirectToFieldMapping nameMapping = new DirectToFieldMapping();
    nameMapping.setAttributeName("name");
    nameMapping.setFieldName("PROJECT.PROJ_NAME");
    nameMapping.setNullValue("");
    descriptor.addMapping(nameMapping);

    OneToOneMapping teamLeaderMapping = new OneToOneMapping();
    teamLeaderMapping.setAttributeName("teamLeaderHolder");
    teamLeaderMapping.setReferenceClass(Employee.class);
    teamLeaderMapping.useBasicIndirection();
    teamLeaderMapping.addForeignKeyFieldName("PROJECT.LEADER_ID", "EMPLOYEE.EMP_ID");
    descriptor.addMapping(teamLeaderMapping);

    return descriptor;
  }
  protected void buildDirectEntityMapHolderDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

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

    // SECTION: PROPERTIES
    descriptor.setIdentityMapClass(
        org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
    descriptor.setExistenceChecking("Check cache");
    descriptor.setIdentityMapSize(100);
    descriptor.setSequenceNumberName("DIR_ENT_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("DIR_ENT_MAP_HOLDER.ID");
    descriptor.addMapping(directtofieldmapping);

    ManyToManyMapping mapMapping = new ManyToManyMapping();
    mapMapping.setAttributeName("directToEntityMap");
    mapMapping.setIndirectionPolicy(new TransparentIndirectionPolicy());
    mapMapping.setReferenceClass(EntityMapValue.class);
    mapMapping.setRelationTableName("DIR_ENT_MAP_REL");
    mapMapping.setGetMethodName("getDirectToEntityMap");
    mapMapping.setSetMethodName("setDirectToEntityMap");
    mapMapping.addSourceRelationKeyFieldName("DIR_ENT_MAP_REL.HOLDER_ID", "DIR_ENT_MAP_HOLDER.ID");
    mapMapping.addTargetRelationKeyFieldName("DIR_ENT_MAP_REL.VALUE_ID", "ENT_MAP_VALUE.ID");

    org.eclipse.persistence.mappings.DirectToFieldMapping keyMapping =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    keyMapping.setFieldName("DIR_ENT_MAP_REL.MAP_KEY");
    keyMapping.setAttributeClassification(Integer.class);
    keyMapping.setDescriptor(descriptor);

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

    descriptor.addMapping(mapMapping);

    addDescriptor(descriptor);
  }
  protected void buildAggregateDirectMapHolderDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

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

    // SECTION: PROPERTIES
    descriptor.setIdentityMapClass(
        org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
    descriptor.setExistenceChecking("Check cache");
    descriptor.setIdentityMapSize(100);
    descriptor.setSequenceNumberName("AGG_DIR_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_DIR_MAP_HOLDER.ID");
    descriptor.addMapping(directtofieldmapping);

    DirectMapMapping directMapMapping = new DirectMapMapping();
    directMapMapping.setAttributeName("aggregateToDirectMap");
    directMapMapping.setGetMethodName("getAggregateToDirectMap");
    directMapMapping.setSetMethodName("setAggregateToDirectMap");
    directMapMapping.setReferenceTableName("AGG_DIR_MAP_REL");
    directMapMapping.setDirectFieldName("AGG_DIR_MAP_REL.MAP_VALUE");
    directMapMapping.addReferenceKeyFieldName("AGG_DIR_MAP_REL.HOLDER_ID", "AGG_DIR_MAP_HOLDER.ID");
    directMapMapping.setDirectFieldClassification(Integer.class);
    directMapMapping.setIndirectionPolicy(new TransparentIndirectionPolicy());

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

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

    descriptor.addMapping(directMapMapping);

    addDescriptor(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 buildStudioDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

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

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

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

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

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

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

    // SECTION: ONETOONEMAPPING
    org.eclipse.persistence.mappings.OneToOneMapping onetoonemapping =
        new org.eclipse.persistence.mappings.OneToOneMapping();
    onetoonemapping.setAttributeName("address");
    onetoonemapping.setIsReadOnly(false);
    onetoonemapping.setUsesIndirection(false);
    onetoonemapping.setReferenceClass(
        org.eclipse.persistence.testing.models.readonly.Address.class);
    onetoonemapping.setIsPrivateOwned(true);
    onetoonemapping.addForeignKeyFieldName("RO_MOVIE.STD_ADD", "RO_ADDR.ADD_ID");
    descriptor.addMapping(onetoonemapping);
    addDescriptor(descriptor);
  }
  protected void buildEntityMapValueDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

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

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

    // 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("ENT_MAP_VALUE.ID");
    descriptor.addMapping(directtofieldmapping);

    addDescriptor(descriptor);
  }
  public ClassDescriptor buildPhoneNumberDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(PhoneNumber.class);
    descriptor.addTableName("PHONE");
    descriptor.addPrimaryKeyFieldName("PHONE.PHONE_ID");

    // Descriptor Properties.
    descriptor.useSoftCacheWeakIdentityMap();
    descriptor.setIdentityMapSize(100);
    descriptor.setSequenceNumberFieldName("PHONE.PHONE_ID");
    descriptor.setSequenceNumberName("PHONE_SEQ");
    descriptor.setAlias("PhoneNumber");

    // Query keys.
    descriptor.addDirectQueryKey("id", "PHONE.EMP_ID");

    // Mappings.
    DirectToFieldMapping idMapping = new DirectToFieldMapping();
    idMapping.setAttributeName("id");
    idMapping.setFieldName("PHONE.PHONE_ID");
    descriptor.addMapping(idMapping);

    DirectToFieldMapping areaCodeMapping = new DirectToFieldMapping();
    areaCodeMapping.setAttributeName("areaCode");
    areaCodeMapping.setFieldName("PHONE.AREA_CODE");
    descriptor.addMapping(areaCodeMapping);

    DirectToFieldMapping numberMapping = new DirectToFieldMapping();
    numberMapping.setAttributeName("number");
    numberMapping.setFieldName("PHONE.P_NUMBER");
    descriptor.addMapping(numberMapping);

    DirectToFieldMapping typeMapping = new DirectToFieldMapping();
    typeMapping.setAttributeName("type");
    typeMapping.setFieldName("PHONE.TYPE");
    descriptor.addMapping(typeMapping);

    OneToOneMapping ownerMapping = new OneToOneMapping();
    ownerMapping.setAttributeName("ownerHolder");
    ownerMapping.setReferenceClass(Employee.class);
    ownerMapping.useBasicIndirection();
    ownerMapping.addForeignKeyFieldName("PHONE.EMP_ID", "EMPLOYEE.EMP_ID");
    descriptor.addMapping(ownerMapping);

    return descriptor;
  }
예제 #12
0
  public static RelationalDescriptor descriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

    // SECTION: DESCRIPTOR
    descriptor.setJavaClass(Budget.class);
    descriptor.setTableName("BUDGET");
    descriptor.addPrimaryKeyFieldName("BUDGET.ID");

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

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping1 =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping1.setAttributeName("currency");
    directtofieldmapping1.setIsReadOnly(false);
    directtofieldmapping1.setFieldName("BUDGET.CUR");
    descriptor.addMapping(directtofieldmapping1);

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping2 =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping2.setAttributeName("amount");
    directtofieldmapping2.setIsReadOnly(false);
    directtofieldmapping2.setFieldName("BUDGET.AMNT");
    descriptor.addMapping(directtofieldmapping2);

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping3 =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping3.setAttributeName("id");
    directtofieldmapping3.setIsReadOnly(false);
    directtofieldmapping3.setFieldName("BUDGET.ID");
    descriptor.addMapping(directtofieldmapping3);

    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 buildPromoterDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

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

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

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

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

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

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping1 =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping1.setAttributeName("name");
    directtofieldmapping1.setIsReadOnly(false);
    directtofieldmapping1.setFieldName("RO_PROMO.NAME");
    descriptor.addMapping(directtofieldmapping1);
    addDescriptor(descriptor);
  }
  public ClassDescriptor buildEmploymentPeriodDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.descriptorIsAggregate();
    descriptor.setJavaClass(
        org.eclipse.persistence.testing.models.performance.EmploymentPeriod.class);

    // Descriptor Properties.
    descriptor.setAlias("EmploymentPeriod");

    // Mappings.
    DirectToFieldMapping endDateMapping = new DirectToFieldMapping();
    endDateMapping.setAttributeName("endDate");
    endDateMapping.setFieldName("endDate->DIRECT");
    descriptor.addMapping(endDateMapping);

    DirectToFieldMapping startDateMapping = new DirectToFieldMapping();
    startDateMapping.setAttributeName("startDate");
    startDateMapping.setFieldName("startDate->DIRECT");
    descriptor.addMapping(startDateMapping);

    return descriptor;
  }
  protected void buildAEOTMValueDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

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

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

    // 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("AE_OM_ENT_MAP_VALUE.ID");
    descriptor.addMapping(directtofieldmapping);

    OneToOneMapping holderMapping = new OneToOneMapping();
    holderMapping.setAttributeName("holder");
    holderMapping.setReferenceClass(AggregateEntity1MMapHolder.class);
    holderMapping.useBasicIndirection();
    holderMapping.setGetMethodName("getHolder");
    holderMapping.setSetMethodName("setHolder");
    holderMapping.addForeignKeyFieldName(
        "AE_OM_ENT_MAP_VALUE.HOLDER_ID", "AGG_ENT_1M_MAP_HOLDER.ID");
    descriptor.addMapping(holderMapping);

    addDescriptor(descriptor);
  }
  public ClassDescriptor buildLargeProjectDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(LargeProject.class);
    descriptor.addTableName("LPROJECT");

    // Inheritance Properties.
    descriptor.getInheritancePolicy().setParentClass(Project.class);

    // Descriptor Properties.
    descriptor.setAlias("LargeProject");

    // Mappings.
    DirectToFieldMapping budgetMapping = new DirectToFieldMapping();
    budgetMapping.setAttributeName("budget");
    budgetMapping.setFieldName("LPROJECT.BUDGET");
    descriptor.addMapping(budgetMapping);

    DirectToFieldMapping milestoneVersionMapping = new DirectToFieldMapping();
    milestoneVersionMapping.setAttributeName("milestoneVersion");
    milestoneVersionMapping.setFieldName("LPROJECT.MILESTONE");
    descriptor.addMapping(milestoneVersionMapping);

    return descriptor;
  }
  protected void buildAggregateMapKeyDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.descriptorIsAggregateCollection();
    descriptor.setJavaClass(AggregateMapKey.class);

    // Descriptor Properties.
    descriptor.setAlias("AggregateMapKey");

    // Mappings.
    DirectToFieldMapping keyMapping = new DirectToFieldMapping();
    keyMapping.setAttributeName("key");
    keyMapping.setFieldName("key->DIRECT");
    keyMapping.setAttributeClassification(Integer.class);
    descriptor.addMapping(keyMapping);

    addDescriptor(descriptor);
  }
예제 #18
0
  public ClassDescriptor buildAddressDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(Address.class);
    descriptor.addTableName("OTOJT_ADDRESS");
    descriptor.addPrimaryKeyFieldName("OTOJT_ADDRESS.ADDRESS_ID");

    // Descriptor Properties.
    descriptor.useSoftCacheWeakIdentityMap();
    descriptor.setIdentityMapSize(100);
    descriptor.setSequenceNumberFieldName("OTOJT_ADDRESS.ADDRESS_ID");
    descriptor.setSequenceNumberName("OTOJT_ADDRESS_SEQ");
    descriptor.setAlias("OTOJT_Address");

    // Cache Invalidation Policy
    // Query Manager.
    descriptor.getQueryManager().checkCacheForDoesExist();

    // Named Queries.
    // Event Manager.
    // Mappings.
    DirectToFieldMapping cityMapping = new DirectToFieldMapping();
    cityMapping.setAttributeName("city");
    cityMapping.setFieldName("OTOJT_ADDRESS.CITY");
    descriptor.addMapping(cityMapping);

    DirectToFieldMapping countryMapping = new DirectToFieldMapping();
    countryMapping.setAttributeName("country");
    countryMapping.setFieldName("OTOJT_ADDRESS.COUNTRY");
    descriptor.addMapping(countryMapping);

    DirectToFieldMapping idMapping = new DirectToFieldMapping();
    idMapping.setAttributeName("id");
    idMapping.setFieldName("OTOJT_ADDRESS.ADDRESS_ID");
    descriptor.addMapping(idMapping);

    DirectToFieldMapping postalCodeMapping = new DirectToFieldMapping();
    postalCodeMapping.setAttributeName("postalCode");
    postalCodeMapping.setFieldName("OTOJT_ADDRESS.P_CODE");
    descriptor.addMapping(postalCodeMapping);

    DirectToFieldMapping provinceMapping = new DirectToFieldMapping();
    provinceMapping.setAttributeName("province");
    provinceMapping.setFieldName("OTOJT_ADDRESS.PROVINCE");
    descriptor.addMapping(provinceMapping);

    DirectToFieldMapping streetMapping = new DirectToFieldMapping();
    streetMapping.setAttributeName("street");
    streetMapping.setFieldName("OTOJT_ADDRESS.STREET");
    descriptor.addMapping(streetMapping);

    return descriptor;
  }
  protected void buildDefaultReadOnlyTestClassDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(
        org.eclipse.persistence.testing.models.readonly.DefaultReadOnlyTestClass.class);
    descriptor.setTableName("DEFAULT_READ_ONLY");
    descriptor.setPrimaryKeyFieldName("DEFAULT_READ_ONLY.DATA");

    org.eclipse.persistence.mappings.DirectToFieldMapping directToFieldMapping =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directToFieldMapping.setAttributeName("data");
    directToFieldMapping.setFieldName("DEFAULT_READ_ONLY.DATA");
    directToFieldMapping.setGetMethodName("getData");
    directToFieldMapping.setSetMethodName("setData");
    descriptor.addMapping(directToFieldMapping);

    addDescriptor(descriptor);
    addDefaultReadOnlyClass(
        org.eclipse.persistence.testing.models.readonly.DefaultReadOnlyTestClass.class);
  }
  public ClassDescriptor buildAddressDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(org.eclipse.persistence.testing.models.performance.Address.class);
    descriptor.addTableName("ADDRESS");
    descriptor.addPrimaryKeyFieldName("ADDRESS.ADDRESS_ID");

    // Descriptor Properties.
    descriptor.useSoftCacheWeakIdentityMap();
    descriptor.setIdentityMapSize(100);
    descriptor.setSequenceNumberFieldName("ADDRESS.ADDRESS_ID");
    descriptor.setSequenceNumberName("ADDRESS_SEQ");
    descriptor.setAlias("Address");

    // Mappings.
    DirectToFieldMapping cityMapping = new DirectToFieldMapping();
    cityMapping.setAttributeName("city");
    cityMapping.setFieldName("ADDRESS.CITY");
    descriptor.addMapping(cityMapping);

    DirectToFieldMapping countryMapping = new DirectToFieldMapping();
    countryMapping.setAttributeName("country");
    countryMapping.setFieldName("ADDRESS.COUNTRY");
    descriptor.addMapping(countryMapping);

    DirectToFieldMapping idMapping = new DirectToFieldMapping();
    idMapping.setAttributeName("id");
    idMapping.setFieldName("ADDRESS.ADDRESS_ID");
    descriptor.addMapping(idMapping);

    DirectToFieldMapping postalCodeMapping = new DirectToFieldMapping();
    postalCodeMapping.setAttributeName("postalCode");
    postalCodeMapping.setFieldName("ADDRESS.P_CODE");
    descriptor.addMapping(postalCodeMapping);

    DirectToFieldMapping provinceMapping = new DirectToFieldMapping();
    provinceMapping.setAttributeName("province");
    provinceMapping.setFieldName("ADDRESS.PROVINCE");
    descriptor.addMapping(provinceMapping);

    DirectToFieldMapping streetMapping = new DirectToFieldMapping();
    streetMapping.setAttributeName("street");
    streetMapping.setFieldName("ADDRESS.STREET");
    descriptor.addMapping(streetMapping);

    return descriptor;
  }
  public RelationalDescriptor descriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(org.eclipse.persistence.testing.models.employee.domain.Employee.class);
    descriptor.addTableName("EMPLOYEE");
    descriptor.addPrimaryKeyFieldName("EMPLOYEE.EMP_ID");

    // Descriptor properties.
    descriptor.useFullIdentityMap();
    descriptor.setIdentityMapSize(100);
    descriptor.useRemoteFullIdentityMap();
    descriptor.setRemoteIdentityMapSize(100);
    descriptor.setSequenceNumberFieldName("EMP_ID");
    descriptor.setSequenceNumberName("EMP_SEQ");

    // the following causes the correct error to occure.
    descriptor.setExistenceChecking("Check Bash");

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

    return descriptor;
  }
  /** This method was created in VisualAge. */
  public void buildPrivateConstructorDescriptor() {
    org.eclipse.persistence.descriptors.RelationalDescriptor descriptor =
        new org.eclipse.persistence.descriptors.RelationalDescriptor();

    // SECTION: DESCRIPTOR
    descriptor.setJavaClass(
        org.eclipse.persistence.testing.tests.validation.PrivateConstructor.class);
    Vector vector = new Vector();
    vector.addElement("PRIVATE_CONST_TBL");
    descriptor.setTableNames(vector);
    descriptor.addPrimaryKeyFieldName("PRIVATE_CONST_TBL.PRIVATE_CONST_ID");

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

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

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

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

    addDescriptor(descriptor);
  }
예제 #23
0
  public ClassDescriptor buildChildDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(Child.class);
    descriptor.addTableName("OTOJT_CHILD");
    descriptor.addPrimaryKeyFieldName("OTOJT_CHILD.CHILD_ID");

    descriptor.useSoftCacheWeakIdentityMap();
    descriptor.setIdentityMapSize(50);
    descriptor.setSequenceNumberFieldName("OTOJT_CHILD.CHILD_ID");
    descriptor.setSequenceNumberName("OTOJT_CHILD_SEQ");
    descriptor.setAlias("OTOJT_Child");

    // Query Manager.
    descriptor.getQueryManager().checkCacheForDoesExist();

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

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

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

    DirectToFieldMapping genderMapping = new DirectToFieldMapping();
    genderMapping.setAttributeName("gender");
    genderMapping.setFieldName("GENDER");
    ObjectTypeConverter genderMappingConverter = new ObjectTypeConverter();
    genderMappingConverter.addConversionValue("F", "Female");
    genderMappingConverter.addConversionValue("M", "Male");
    genderMapping.setConverter(genderMappingConverter);
    descriptor.addMapping(genderMapping);

    DirectToFieldMapping birthdayMapping = new DirectToFieldMapping();
    birthdayMapping.setAttributeName("birthday");
    birthdayMapping.setFieldName("BIRTHDAY");
    descriptor.addMapping(birthdayMapping);

    OneToOneMapping parentMapping = new OneToOneMapping();
    parentMapping.setAttributeName("parent");
    parentMapping.setReferenceClass(Employee.class);
    parentMapping.dontUseIndirection();
    parentMapping.setRelationTableMechanism(new RelationTableMechanism());
    parentMapping.getRelationTableMechanism().setRelationTableName("OTOJT_CHILD_PARENT");
    parentMapping
        .getRelationTableMechanism()
        .addSourceRelationKeyFieldName("OTOJT_CHILD_PARENT.CHILD_ID", "OTOJT_CHILD.CHILD_ID");
    parentMapping
        .getRelationTableMechanism()
        .addTargetRelationKeyFieldName("OTOJT_CHILD_PARENT.EMP_ID", "OTOJT_EMPLOYEE.EMP_ID");
    //        parentMapping.addForeignKeyFieldName("OTOJT_CHILD.PARENT_EMP_ID",
    // "OTOJT_EMPLOYEE.EMP_ID");
    parentMapping.readOnly();
    descriptor.addMapping(parentMapping);

    return descriptor;
  }
  /** modifications are marked with "bjv" */
  protected void buildOrderDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

    // SECTION: DESCRIPTOR
    descriptor.setJavaClass(this.orderClass()); // bjv
    Vector vector = new Vector();
    vector.addElement("ORD");
    descriptor.setTableNames(vector);
    descriptor.addPrimaryKeyFieldName("ORD.ID");

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

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

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

    // SECTION: DIRECTCOLLECTIONMAPPING
    org.eclipse.persistence.mappings.DirectCollectionMapping directcollectionmapping =
        new org.eclipse.persistence.mappings.DirectCollectionMapping();
    directcollectionmapping.setAttributeName("contacts");
    directcollectionmapping.setIsReadOnly(false);
    directcollectionmapping.setUsesIndirection(false);
    directcollectionmapping.setIsPrivateOwned(true);
    this.configureContactContainer(directcollectionmapping); // bjv
    directcollectionmapping.setDirectFieldName("CONTACT.NAME");
    directcollectionmapping.setReferenceTableName("CONTACT");
    directcollectionmapping.addReferenceKeyFieldName("CONTACT.ORDER_ID", "ORD.ID");
    descriptor.addMapping(directcollectionmapping);

    // SECTION: DIRECTCOLLECTIONMAPPING
    org.eclipse.persistence.mappings.DirectCollectionMapping directcollectionmapping1 =
        new org.eclipse.persistence.mappings.DirectCollectionMapping();
    directcollectionmapping1.setAttributeName("contacts2");
    directcollectionmapping1.setIsReadOnly(false);
    directcollectionmapping1.setUsesIndirection(false);
    directcollectionmapping1.setIsPrivateOwned(true);
    this.configureContactContainer2(directcollectionmapping1); // bjv
    directcollectionmapping1.setDirectFieldName("CONTACT2.NAME");
    directcollectionmapping1.setReferenceTableName("CONTACT2");
    directcollectionmapping1.addReferenceKeyFieldName("CONTACT2.ORDER_ID", "ORD.ID");
    descriptor.addMapping(directcollectionmapping1);

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping.setAttributeName("customerName");
    directtofieldmapping.setIsReadOnly(false);
    directtofieldmapping.setFieldName("ORD.CUSTNAME");
    descriptor.addMapping(directtofieldmapping);

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping1 =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping1.setAttributeName("id");
    directtofieldmapping1.setIsReadOnly(false);
    directtofieldmapping1.setFieldName("ORD.ID");
    descriptor.addMapping(directtofieldmapping1);

    // SECTION: MANYTOMANYMAPPING
    org.eclipse.persistence.mappings.ManyToManyMapping manytomanymapping =
        new org.eclipse.persistence.mappings.ManyToManyMapping();
    manytomanymapping.setAttributeName("salesReps");
    manytomanymapping.setIsReadOnly(false);
    manytomanymapping.setUsesIndirection(false);
    manytomanymapping.setReferenceClass(salesRepClass());
    manytomanymapping.setIsPrivateOwned(false);
    this.configureSalesRepContainer(manytomanymapping); // bjv
    manytomanymapping.setRelationTableName("ORDREP");
    manytomanymapping.addSourceRelationKeyFieldName("ORDREP.ORDER_ID", "ORD.ID");
    manytomanymapping.addTargetRelationKeyFieldName("ORDREP.SALEREP_ID", "SALEREP.ID");
    descriptor.addMapping(manytomanymapping);

    // SECTION: MANYTOMANYMAPPING
    org.eclipse.persistence.mappings.ManyToManyMapping manytomanymapping1 =
        new org.eclipse.persistence.mappings.ManyToManyMapping();
    manytomanymapping1.setAttributeName("salesReps2");
    manytomanymapping1.setIsReadOnly(false);
    manytomanymapping1.setUsesIndirection(false);
    manytomanymapping1.setReferenceClass(salesRepClass());
    manytomanymapping1.setIsPrivateOwned(false);
    this.configureSalesRepContainer2(manytomanymapping1); // bjv
    manytomanymapping1.setRelationTableName("ORDREP2");
    manytomanymapping1.addSourceRelationKeyFieldName("ORDREP2.ORDER_ID", "ORD.ID");
    manytomanymapping1.addTargetRelationKeyFieldName("ORDREP2.SALEREP_ID", "SALEREP.ID");
    descriptor.addMapping(manytomanymapping1);

    // SECTION: ONETOMANYMAPPING
    org.eclipse.persistence.mappings.OneToManyMapping onetomanymapping =
        new org.eclipse.persistence.mappings.OneToManyMapping();
    onetomanymapping.setAttributeName("lines");
    onetomanymapping.setIsReadOnly(false);
    onetomanymapping.setUsesIndirection(false);
    onetomanymapping.setReferenceClass(orderLineClass());
    onetomanymapping.setIsPrivateOwned(true);
    this.configureLineContainer(onetomanymapping); // bjv
    onetomanymapping.addTargetForeignKeyFieldName("ORDLINE.ORDER_ID", "ORD.ID");
    descriptor.addMapping(onetomanymapping);

    // SECTION: TRANSFORMATIONMAPPING
    org.eclipse.persistence.mappings.TransformationMapping transformationmapping =
        new org.eclipse.persistence.mappings.TransformationMapping();
    transformationmapping.setAttributeName("total");
    transformationmapping.setIsReadOnly(false);
    transformationmapping.setUsesIndirection(true);
    transformationmapping.setAttributeTransformation("getTotalFromRow");
    transformationmapping.addFieldTransformation("ORD.TOTT", "getTotalTens");
    transformationmapping.addFieldTransformation("ORD.TOTO", "getTotalOnes");
    descriptor.addMapping(transformationmapping);

    // SECTION: TRANSFORMATIONMAPPING
    org.eclipse.persistence.mappings.TransformationMapping transformationmapping2 =
        new org.eclipse.persistence.mappings.TransformationMapping();
    transformationmapping2.setAttributeName("total2");
    transformationmapping2.setIsReadOnly(false);
    transformationmapping2.setUsesIndirection(false);
    transformationmapping2.setAttributeTransformation("getTotalFromRow2");
    transformationmapping2.addFieldTransformation("ORD.TOTT2", "getTotalTens2");
    transformationmapping2.addFieldTransformation("ORD.TOTO2", "getTotalOnes2");
    descriptor.addMapping(transformationmapping2);

    this.modifyOrderDescriptor(descriptor); // bjv
    addDescriptor(descriptor);
  }
  public RelationalDescriptor buildProjectDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(org.eclipse.persistence.testing.models.employee.domain.Project.class);
    descriptor.addTableName("PROJECT");
    descriptor.addPrimaryKeyFieldName("PROJECT.PROJ_ID");

    // Inheritance properties.
    descriptor.getInheritancePolicy().setClassIndicatorFieldName("PROJ_TYPE");
    descriptor
        .getInheritancePolicy()
        .addClassIndicator(
            org.eclipse.persistence.testing.models.employee.domain.LargeProject.class, "L");
    descriptor
        .getInheritancePolicy()
        .addClassIndicator(
            org.eclipse.persistence.testing.models.employee.domain.SmallProject.class, "S");

    // Interface properties.
    // the following causes the correct error to occure.
    descriptor
        .getInterfacePolicy()
        .addParentInterface(
            org.eclipse.persistence.testing.models.employee.interfaces.LargeProject.class);

    // Descriptor properties.
    descriptor.useFullIdentityMap();
    descriptor.setIdentityMapSize(100);
    descriptor.useRemoteFullIdentityMap();
    descriptor.setRemoteIdentityMapSize(100);
    descriptor.setSequenceNumberFieldName("PROJ_ID");
    descriptor.setSequenceNumberName("PROJ_SEQ");

    // Query manager.
    descriptor.getQueryManager().checkCacheForDoesExist();

    // Event manager.

    // Mappings.
    DirectToFieldMapping descriptionMapping = new DirectToFieldMapping();
    descriptionMapping.setAttributeName("description");
    descriptionMapping.setFieldName("PROJECT.DESCRIP");
    descriptionMapping.setNullValue("");
    descriptor.addMapping(descriptionMapping);

    DirectToFieldMapping idMapping = new DirectToFieldMapping();
    idMapping.setAttributeName("id");
    idMapping.setFieldName("PROJECT.PROJ_ID");
    descriptor.addMapping(idMapping);

    /*	DirectToFieldMapping nameMapping = new DirectToFieldMapping();
    nameMapping.setAttributeName("name");
    nameMapping.setFieldName("PROJECT.PROJ_NAME");
    nameMapping.setNullValue("");
    descriptor.addMapping(nameMapping);
    */
    /*	OneToOneMapping teamLeaderMapping = new OneToOneMapping();
    teamLeaderMapping.setAttributeName("teamLeader");
    teamLeaderMapping.setReferenceClass(org.eclipse.persistence.testing.models.employee.domain.Employee.class);
    teamLeaderMapping.useBasicIndirection();
    teamLeaderMapping.addForeignKeyFieldName("PROJECT.LEADER_ID", "EMPLOYEE.EMP_ID");
    descriptor.addMapping(teamLeaderMapping);
    */
    return descriptor;
  }
  public ClassDescriptor buildPojoEmployeeDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(
        org.eclipse.persistence.testing.tests.simplepojoclient.PojoEmployee.class);
    descriptor.addTableName("POJO_EMPLOYEE");
    descriptor.addPrimaryKeyFieldName("POJO_EMPLOYEE.EMP_ID");

    // Descriptor Properties.
    descriptor.useSoftCacheWeakIdentityMap();
    descriptor.setIdentityMapSize(100);
    descriptor.useRemoteSoftCacheWeakIdentityMap();
    descriptor.setRemoteIdentityMapSize(100);
    descriptor.setAlias("PojoEmployee");

    // Query Manager.
    descriptor.getQueryManager().checkCacheForDoesExist();

    // Event Manager.

    // Mappings.
    DirectToFieldMapping empIdMapping = new DirectToFieldMapping();
    empIdMapping.setAttributeName("empId");
    empIdMapping.setGetMethodName("getEmpId");
    empIdMapping.setSetMethodName("setEmpId");
    empIdMapping.setFieldName("POJO_EMPLOYEE.EMP_ID");
    descriptor.addMapping(empIdMapping);

    DirectToFieldMapping fNameMapping = new DirectToFieldMapping();
    fNameMapping.setAttributeName("fName");
    fNameMapping.setGetMethodName("getFName");
    fNameMapping.setSetMethodName("setFName");
    fNameMapping.setFieldName("POJO_EMPLOYEE.F_NAME");
    descriptor.addMapping(fNameMapping);

    DirectToFieldMapping genderMapping = new DirectToFieldMapping();
    genderMapping.setAttributeName("gender");
    genderMapping.setGetMethodName("getGender");
    genderMapping.setSetMethodName("setGender");
    genderMapping.setFieldName("POJO_EMPLOYEE.GENDER");
    ObjectTypeConverter genderMappingConverter = new ObjectTypeConverter();
    genderMappingConverter.addConversionValue(new Character('F'), "Female");
    genderMappingConverter.addConversionValue(new Character('M'), "Male");
    genderMapping.setConverter(genderMappingConverter);
    descriptor.addMapping(genderMapping);

    DirectToFieldMapping lNameMapping = new DirectToFieldMapping();
    lNameMapping.setAttributeName("lName");
    lNameMapping.setGetMethodName("getLName");
    lNameMapping.setSetMethodName("setLName");
    lNameMapping.setFieldName("POJO_EMPLOYEE.L_NAME");
    descriptor.addMapping(lNameMapping);

    DirectToFieldMapping managerIdMapping = new DirectToFieldMapping();
    managerIdMapping.setAttributeName("managerId");
    managerIdMapping.setGetMethodName("getManagerId");
    managerIdMapping.setSetMethodName("setManagerId");
    managerIdMapping.setFieldName("POJO_EMPLOYEE.MANAGER_ID");
    descriptor.addMapping(managerIdMapping);

    return descriptor;
  }
예제 #27
0
  public ClassDescriptor buildEmployeeDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(Employee.class);
    descriptor.addTableName("OTOJT_EMPLOYEE");
    descriptor.addTableName("OTOJT_SALARY");
    descriptor.addPrimaryKeyFieldName("OTOJT_EMPLOYEE.EMP_ID");

    // Descriptor Properties.
    descriptor.useSoftCacheWeakIdentityMap();
    descriptor.setIdentityMapSize(100);
    descriptor.setSequenceNumberFieldName("OTOJT_EMPLOYEE.EMP_ID");
    descriptor.setSequenceNumberName("OTOJT_EMP_SEQ");
    VersionLockingPolicy lockingPolicy = new VersionLockingPolicy();
    lockingPolicy.setWriteLockFieldName("OTOJT_EMPLOYEE.VERSION");
    descriptor.setOptimisticLockingPolicy(lockingPolicy);
    descriptor.setAlias("OTOJT_Employee");

    // Cache Invalidation Policy
    // Query Manager.
    descriptor.getQueryManager().checkCacheForDoesExist();

    // Named Queries.
    // Event Manager.
    // Mappings.
    DirectToFieldMapping firstNameMapping = new DirectToFieldMapping();
    firstNameMapping.setAttributeName("firstName");
    firstNameMapping.setFieldName("OTOJT_EMPLOYEE.F_NAME");
    firstNameMapping.setNullValue("");
    descriptor.addMapping(firstNameMapping);

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

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

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

    DirectToFieldMapping genderMapping = new DirectToFieldMapping();
    genderMapping.setAttributeName("gender");
    genderMapping.setFieldName("OTOJT_EMPLOYEE.GENDER");
    ObjectTypeConverter genderMappingConverter = new ObjectTypeConverter();
    genderMappingConverter.addConversionValue("F", "Female");
    genderMappingConverter.addConversionValue("M", "Male");
    genderMapping.setConverter(genderMappingConverter);
    descriptor.addMapping(genderMapping);

    DirectCollectionMapping responsibilitiesListMapping = new DirectCollectionMapping();
    responsibilitiesListMapping.setAttributeName("responsibilitiesList");
    responsibilitiesListMapping.useTransparentList();
    responsibilitiesListMapping.setReferenceTableName("OTOJT_RESPONS");
    responsibilitiesListMapping.setDirectFieldName("OTOJT_RESPONS.DESCRIP");
    responsibilitiesListMapping.addReferenceKeyFieldName(
        "OTOJT_RESPONS.EMP_ID", "OTOJT_EMPLOYEE.EMP_ID");
    descriptor.addMapping(responsibilitiesListMapping);

    OneToOneMapping addressMapping = new OneToOneMapping();
    addressMapping.setAttributeName("address");
    addressMapping.setReferenceClass(Address.class);
    addressMapping.useBasicIndirection();
    addressMapping.privateOwnedRelationship();
    //        addressMapping.addForeignKeyFieldName("OTOJT_EMPLOYEE.ADDR_ID",
    // "OTOJT_ADDRESS.ADDRESS_ID");
    addressMapping.setRelationTableMechanism(new RelationTableMechanism());
    addressMapping.getRelationTableMechanism().setRelationTableName("OTOJT_EMP_ADDRESS");
    addressMapping
        .getRelationTableMechanism()
        .addSourceRelationKeyFieldName("OTOJT_EMP_ADDRESS.EMP_ID", "OTOJT_EMPLOYEE.EMP_ID");
    addressMapping
        .getRelationTableMechanism()
        .addTargetRelationKeyFieldName("OTOJT_EMP_ADDRESS.ADDR_ID", "OTOJT_ADDRESS.ADDRESS_ID");
    descriptor.addMapping(addressMapping);

    // Joel:EJBQLTesting
    OneToOneMapping managerMapping = new OneToOneMapping();
    managerMapping.setAttributeName("manager");
    managerMapping.setReferenceClass(Employee.class);
    managerMapping.useBasicIndirection();
    //        managerMapping.addForeignKeyFieldName("OTOJT_EMPLOYEE.MANAGER_ID",
    // "OTOJT_EMPLOYEE.EMP_ID");
    managerMapping.setRelationTableMechanism(new RelationTableMechanism());
    managerMapping.getRelationTableMechanism().setRelationTableName("OTOJT_EMP_MANAGER");
    managerMapping
        .getRelationTableMechanism()
        .addSourceRelationKeyFieldName("OTOJT_EMP_MANAGER.EMP_ID", "OTOJT_EMPLOYEE.EMP_ID");
    managerMapping
        .getRelationTableMechanism()
        .addTargetRelationKeyFieldName("OTOJT_EMP_MANAGER.MANAGER_ID", "OTOJT_EMPLOYEE.EMP_ID");
    descriptor.addMapping(managerMapping);

    //        OneToManyMapping managedEmployeesMapping = new OneToManyMapping();
    ManyToManyMapping managedEmployeesMapping = new ManyToManyMapping();
    managedEmployeesMapping.setAttributeName("managedEmployees");
    managedEmployeesMapping.setReferenceClass(Employee.class);
    managedEmployeesMapping.useTransparentList();
    //        managedEmployeesMapping.addTargetForeignKeyFieldName("OTOJT_EMPLOYEE.MANAGER_ID",
    // "OTOJT_EMPLOYEE.EMP_ID");
    managedEmployeesMapping.setRelationTableName("OTOJT_EMP_MANAGER");
    managedEmployeesMapping.addSourceRelationKeyFieldName(
        "OTOJT_EMP_MANAGER.MANAGER_ID", "OTOJT_EMPLOYEE.EMP_ID");
    managedEmployeesMapping.addTargetRelationKeyFieldName(
        "OTOJT_EMP_MANAGER.EMP_ID", "OTOJT_EMPLOYEE.EMP_ID");
    managedEmployeesMapping.readOnly();
    descriptor.addMapping(managedEmployeesMapping);

    //        OneToManyMapping childrenMapping = new OneToManyMapping();
    ManyToManyMapping childrenMapping = new ManyToManyMapping();
    childrenMapping.setAttributeName("children");
    childrenMapping.setReferenceClass(Child.class);
    childrenMapping.addAscendingOrdering("birthday");
    childrenMapping.useTransparentList();
    childrenMapping.privateOwnedRelationship();
    //        childrenMapping.addTargetForeignKeyFieldName("OTOJT_CHILD.PARENT_EMP_ID",
    // "OTOJT_EMPLOYEE.EMP_ID");
    childrenMapping.setRelationTableName("OTOJT_CHILD_PARENT");
    childrenMapping.addSourceRelationKeyFieldName(
        "OTOJT_CHILD_PARENT.EMP_ID", "OTOJT_EMPLOYEE.EMP_ID");
    childrenMapping.addTargetRelationKeyFieldName(
        "OTOJT_CHILD_PARENT.CHILD_ID", "OTOJT_CHILD.CHILD_ID");
    descriptor.addMapping(childrenMapping);

    ManyToManyMapping projectsMapping = new ManyToManyMapping();
    projectsMapping.setAttributeName("projects");
    projectsMapping.setReferenceClass(Project.class);
    projectsMapping.useTransparentList();
    projectsMapping.setRelationTableName("OTOJT_PROJ_EMP");
    projectsMapping.addSourceRelationKeyFieldName("OTOJT_PROJ_EMP.EMP_ID", "OTOJT_EMPLOYEE.EMP_ID");
    projectsMapping.addTargetRelationKeyFieldName(
        "OTOJT_PROJ_EMP.PROJ_ID", "OTOJT_PROJECT.PROJ_ID");
    descriptor.addMapping(projectsMapping);

    OneToOneMapping projectLedMapping = new OneToOneMapping();
    projectLedMapping.setAttributeName("projectLed");
    projectLedMapping.setReferenceClass(Project.class);
    projectLedMapping.useBasicIndirection();
    projectLedMapping.setRelationTableMechanism(new RelationTableMechanism());
    projectLedMapping.getRelationTableMechanism().setRelationTableName("OTOJT_PROJ_LEADER");
    projectLedMapping
        .getRelationTableMechanism()
        .addSourceRelationKeyFieldName("OTOJT_PROJ_LEADER.EMP_ID", "OTOJT_EMPLOYEE.EMP_ID");
    projectLedMapping
        .getRelationTableMechanism()
        .addTargetRelationKeyFieldName("OTOJT_PROJ_LEADER.PROJ_ID", "PROJ_ID");
    projectLedMapping.readOnly();
    descriptor.addMapping(projectLedMapping);

    return descriptor;
  }
예제 #28
0
  public ClassDescriptor buildProjectDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(Project.class);
    descriptor.addTableName("OTOJT_PROJECT");
    descriptor.addPrimaryKeyFieldName("OTOJT_PROJECT.PROJ_ID");

    // Inheritance Properties.
    descriptor.getInheritancePolicy().setClassIndicatorFieldName("OTOJT_PROJECT.PROJ_TYPE");
    descriptor.getInheritancePolicy().addClassIndicator(SmallProject.class, "S");
    descriptor.getInheritancePolicy().addClassIndicator(LargeProject.class, "L");

    // Descriptor Properties.
    descriptor.useSoftCacheWeakIdentityMap();
    descriptor.setIdentityMapSize(100);
    descriptor.setSequenceNumberFieldName("OTOJT_PROJECT.PROJ_ID");
    descriptor.setSequenceNumberName("OTOJT_PROJ_SEQ");
    VersionLockingPolicy lockingPolicy = new VersionLockingPolicy();
    lockingPolicy.setWriteLockFieldName("OTOJT_PROJECT.VERSION");
    descriptor.setOptimisticLockingPolicy(lockingPolicy);
    descriptor.setAlias("OTOJT_Project");

    // Cache Invalidation Policy
    // Query Manager.
    descriptor.getQueryManager().checkCacheForDoesExist();

    // Named Queries.
    // Event Manager.
    // Mappings.
    DirectToFieldMapping descriptionMapping = new DirectToFieldMapping();
    descriptionMapping.setAttributeName("description");
    descriptionMapping.setFieldName("OTOJT_PROJECT.DESCRIP");
    descriptionMapping.setNullValue("");
    descriptor.addMapping(descriptionMapping);

    DirectToFieldMapping idMapping = new DirectToFieldMapping();
    idMapping.setAttributeName("id");
    idMapping.setFieldName("OTOJT_PROJECT.PROJ_ID");
    descriptor.addMapping(idMapping);

    DirectToFieldMapping nameMapping = new DirectToFieldMapping();
    nameMapping.setAttributeName("name");
    nameMapping.setFieldName("OTOJT_PROJECT.PROJ_NAME");
    nameMapping.setNullValue("");
    descriptor.addMapping(nameMapping);

    OneToOneMapping teamLeaderMapping = new OneToOneMapping();
    teamLeaderMapping.setAttributeName("teamLeader");
    teamLeaderMapping.setReferenceClass(Employee.class);
    teamLeaderMapping.useBasicIndirection();
    //        teamLeaderMapping.addForeignKeyFieldName("OTOJT_PROJECT.LEADER_ID",
    // "OTOJT_EMPLOYEE.EMP_ID");
    teamLeaderMapping.setRelationTableMechanism(new RelationTableMechanism());
    teamLeaderMapping.getRelationTableMechanism().setRelationTableName("OTOJT_PROJ_LEADER");
    teamLeaderMapping
        .getRelationTableMechanism()
        .addSourceRelationKeyFieldName("OTOJT_PROJ_LEADER.PROJ_ID", "PROJ_ID");
    teamLeaderMapping
        .getRelationTableMechanism()
        .addTargetRelationKeyFieldName("OTOJT_PROJ_LEADER.EMP_ID", "OTOJT_EMPLOYEE.EMP_ID");
    descriptor.addMapping(teamLeaderMapping);

    ManyToManyMapping employeesMapping = new ManyToManyMapping();
    employeesMapping.setAttributeName("employees");
    employeesMapping.setReferenceClass(Employee.class);
    employeesMapping.readOnly();
    employeesMapping.useTransparentList();
    employeesMapping.setRelationTableName("OTOJT_PROJ_EMP");
    employeesMapping.addSourceRelationKeyFieldName("OTOJT_PROJ_EMP.PROJ_ID", "PROJ_ID");
    employeesMapping.addTargetRelationKeyFieldName(
        "OTOJT_PROJ_EMP.EMP_ID", "OTOJT_EMPLOYEE.EMP_ID");
    descriptor.addMapping(employeesMapping);

    return 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;
  }
예제 #30
0
  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;
  }