コード例 #1
0
  /** 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);
  }
コード例 #2
0
  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);
  }
コード例 #3
0
  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);
  }
コード例 #4
0
  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);
  }
コード例 #5
0
  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);
  }
コード例 #6
0
  /**
   * 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);
  }
コード例 #7
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;
  }
コード例 #8
0
  /**
   * 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);
  }
コード例 #9
0
  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);
  }
コード例 #10
0
  /** 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);
  }
  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;
  }
コード例 #12
0
  /** 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);
  }
コード例 #13
0
  /** modifications are marked with "bjv" */
  protected void buildSalesRepDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

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

    // SECTION: PROPERTIES
    descriptor.setIdentityMapClass(
        org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
    descriptor.setSequenceNumberName("salesrep");
    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("SALEREP.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("SALEREP.NAME");
    descriptor.addMapping(directtofieldmapping1);

    // SECTION: MANYTOMANYMAPPING
    org.eclipse.persistence.mappings.ManyToManyMapping manytomanymapping =
        new org.eclipse.persistence.mappings.ManyToManyMapping();
    manytomanymapping.setAttributeName("orders");
    manytomanymapping.setIsReadOnly(true);
    manytomanymapping.setUsesIndirection(false);
    manytomanymapping.setReferenceClass(this.orderClass()); // bjv
    manytomanymapping.setIsPrivateOwned(false);
    manytomanymapping.useCollectionClass(java.util.Vector.class);
    manytomanymapping.setRelationTableName("ORDREP");
    manytomanymapping.addSourceRelationKeyFieldName("ORDREP.SALEREP_ID", "SALEREP.ID");
    manytomanymapping.addTargetRelationKeyFieldName("ORDREP.ORDER_ID", "ORD.ID");
    descriptor.addMapping(manytomanymapping);

    // SECTION: MANYTOMANYMAPPING
    org.eclipse.persistence.mappings.ManyToManyMapping manytomanymapping1 =
        new org.eclipse.persistence.mappings.ManyToManyMapping();
    manytomanymapping1.setAttributeName("orders2");
    manytomanymapping1.setIsReadOnly(true);
    manytomanymapping1.setUsesIndirection(false);
    manytomanymapping1.setReferenceClass(this.orderClass()); // bjv
    manytomanymapping1.setIsPrivateOwned(false);
    manytomanymapping1.useCollectionClass(java.util.Vector.class);
    manytomanymapping1.setRelationTableName("ORDREP2");
    manytomanymapping1.addSourceRelationKeyFieldName("ORDREP2.SALEREP_ID", "SALEREP.ID");
    manytomanymapping1.addTargetRelationKeyFieldName("ORDREP2.ORDER_ID", "ORD.ID");
    descriptor.addMapping(manytomanymapping1);
    addDescriptor(descriptor);
  }
コード例 #14
0
  /**
   * 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 buildActorDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

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

    // SECTION: PROPERTIES
    descriptor.setIdentityMapClass(
        org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
    descriptor.setSequenceNumberName("SEQ");
    descriptor.setSequenceNumberFieldName("ACT_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_ACTOR.ACT_ID");
    descriptor.addMapping(directtofieldmapping);

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping1 =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping1.setAttributeName("minimumSalary");
    directtofieldmapping1.setIsReadOnly(false);
    directtofieldmapping1.setFieldName("RO_ACTOR.MIN_SAL");
    descriptor.addMapping(directtofieldmapping1);

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping2 =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping2.setAttributeName("name");
    directtofieldmapping2.setIsReadOnly(false);
    directtofieldmapping2.setFieldName("RO_ACTOR.ACT_NAME");
    descriptor.addMapping(directtofieldmapping2);

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

    // ManyToManyMapping: charities
    ManyToManyMapping charitiesMapping = new ManyToManyMapping();
    charitiesMapping.setAttributeName("charities");
    charitiesMapping.setIsReadOnly(false);
    charitiesMapping.setUsesIndirection(false);
    charitiesMapping.setReferenceClass(ReadOnlyCharity.class);
    charitiesMapping.setIsPrivateOwned(false);
    charitiesMapping.setRelationTableName("ACT_CHA");
    charitiesMapping.setSourceRelationKeyFieldName("ACT_ID");
    charitiesMapping.setTargetRelationKeyFieldName("CHARITY_ID");
    descriptor.addMapping(charitiesMapping);

    // OneToOneMapping: hollywoodAgent
    OneToOneMapping hollywoodAgentMapping = new OneToOneMapping();
    hollywoodAgentMapping.setAttributeName("hollywoodAgent");
    hollywoodAgentMapping.setIsReadOnly(false);
    hollywoodAgentMapping.setUsesIndirection(false);
    hollywoodAgentMapping.setReferenceClass(ReadOnlyHollywoodAgent.class);
    hollywoodAgentMapping.setIsPrivateOwned(false);
    hollywoodAgentMapping.addForeignKeyFieldName("HOLLYWOODAGENT_ID", "HOLLYWOODAGENT_ID");
    descriptor.addMapping(hollywoodAgentMapping);

    addDescriptor(descriptor);
  }
コード例 #15
0
  /**
   * 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);
  }
コード例 #16
0
  /**
   * 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 buildAddressDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

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

    // SECTION: PROPERTIES
    descriptor.setIdentityMapClass(
        org.eclipse.persistence.internal.identitymaps.FullIdentityMap.class);
    descriptor.setSequenceNumberName("ADD_SEQ");
    descriptor.setSequenceNumberFieldName("ADD_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("city");
    directtofieldmapping.setIsReadOnly(false);
    directtofieldmapping.setFieldName("RO_ADDR.CITY");
    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("RO_ADDR.ADD_ID");
    descriptor.addMapping(directtofieldmapping1);

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping2 =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping2.setAttributeName("streetAddress");
    directtofieldmapping2.setIsReadOnly(false);
    directtofieldmapping2.setFieldName("RO_ADDR.STREET");
    descriptor.addMapping(directtofieldmapping2);

    // SECTION: DIRECTTOFIELDMAPPING
    org.eclipse.persistence.mappings.DirectToFieldMapping directtofieldmapping3 =
        new org.eclipse.persistence.mappings.DirectToFieldMapping();
    directtofieldmapping3.setAttributeName("zipCode");
    directtofieldmapping3.setIsReadOnly(false);
    directtofieldmapping3.setFieldName("RO_ADDR.ZIP");
    descriptor.addMapping(directtofieldmapping3);

    // SECTION: ONETOONEMAPPING
    org.eclipse.persistence.mappings.OneToOneMapping onetoonemapping =
        new org.eclipse.persistence.mappings.OneToOneMapping();
    onetoonemapping.setAttributeName("country");
    onetoonemapping.setIsReadOnly(false);
    onetoonemapping.setUsesIndirection(false);
    onetoonemapping.setReferenceClass(
        org.eclipse.persistence.testing.models.readonly.Country.class);
    onetoonemapping.setIsPrivateOwned(false);
    onetoonemapping.addForeignKeyFieldName("RO_ADDR.COUNTRY_ID", "COUNTRY.COUNTRY_ID");
    descriptor.addMapping(onetoonemapping);
    addDescriptor(descriptor);
  }