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);
  }
  /** 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);
  }
Ejemplo n.º 3
0
  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;
  }
  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;
  }
 private static RelationalDescriptor commonDescriptor() {
   RelationalDescriptor descriptor = new RelationalDescriptor();
   descriptor.setJavaClass(CalendarToTSTZWithBindingTest.class);
   descriptor.setTableName("CALENDARTOTSTZ_BINDING");
   descriptor.setPrimaryKeyFieldName("TEST_ID");
   descriptor.addDirectMapping("testId", "getTestId", "setTestId", "TEST_ID");
   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 setup() {
   orgIntegrityChecker = getSession().getIntegrityChecker();
   getSession().setIntegrityChecker(new IntegrityChecker()); // moved into setup
   getSession().getIntegrityChecker().dontCatchExceptions(); // moved into setup
   orgSecurityManager = System.getSecurityManager(); // security java.policy must allow full access
   System.setSecurityManager(new TestSecurityManager());
   orgDefaultUseDoPrivilegedValue = getOrgDefaultUseDoPrivilegedValue();
   PrivilegedAccessHelper.setDefaultUseDoPrivilegedValue(true);
   descriptor = new RelationalDescriptor();
   descriptor.setJavaClass(getTestClass());
 }
  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);
  }
Ejemplo n.º 12
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;
  }
  public ClassDescriptor buildSmallProjectDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(SmallProject.class);
    descriptor.addTableName("SPROJECT");

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

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

    return descriptor;
  }
Ejemplo n.º 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 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);
  }
  public static RelationalDescriptor descriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

    /* First define the class, table and descriptor properties. */
    descriptor.setJavaClass(BooleanTester.class);
    descriptor.setTableName("BOOLEANS");
    descriptor.setPrimaryKeyFieldName("NAME");

    /* Next define the attribute mappings. */
    descriptor.addDirectMapping("testName", "getTestName", "setTestName", "NAME");
    descriptor.addDirectMapping("booleanValue", "BOOLEANV");
    descriptor.addDirectMapping("booleanClassValue", "BOOLEANC");
    return descriptor;
  }
Ejemplo n.º 16
0
  protected void buildHollywoodAgentDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

    descriptor.setJavaClass(HollywoodAgent.class);
    descriptor.setTableName("HOLLYWOODAGENT");
    descriptor.addPrimaryKeyFieldName("HOLLYWOODAGENT_ID");
    descriptor.setSequenceNumberName("HOLLYWOODAGENT_SEQ");
    descriptor.setSequenceNumberFieldName("HOLLYWOODAGENT_ID");

    descriptor.addDirectMapping("id", "HOLLYWOODAGENT_ID");
    descriptor.addDirectMapping("name", "NAME");
    descriptor.addDirectMapping("numberOfConnections", "CONNECTIONS");

    addDescriptor(descriptor);
  }
Ejemplo n.º 17
0
  protected void buildCharityDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

    descriptor.setJavaClass(Charity.class);
    descriptor.setTableName("CHARITY");
    descriptor.addPrimaryKeyFieldName("CHARITY_ID");
    descriptor.setSequenceNumberName("CHARITY_SEQ");
    descriptor.setSequenceNumberFieldName("CHARITY_ID");

    descriptor.addDirectMapping("id", "CHARITY_ID");
    descriptor.addDirectMapping("name", "NAME");
    descriptor.addDirectMapping("donationsRaised", "DONATIONS_RAISED");

    addDescriptor(descriptor);
  }
Ejemplo n.º 18
0
  protected void buildReadOnlyHollywoodAgentDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

    descriptor.setJavaClass(ReadOnlyHollywoodAgent.class);
    descriptor.setTableName("HOLLYWOODAGENT");
    descriptor.addPrimaryKeyFieldName("HOLLYWOODAGENT_ID");
    descriptor.setSequenceNumberName("HOLLYWOODAGENT_SEQ");
    descriptor.setSequenceNumberFieldName("HOLLYWOODAGENT_ID");

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

    addDescriptor(descriptor);

    addDefaultReadOnlyClass(ReadOnlyHollywoodAgent.class);
  }
Ejemplo n.º 19
0
  protected void buildReadOnlyCharityDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();

    descriptor.setJavaClass(ReadOnlyCharity.class);
    descriptor.setTableName("CHARITY");
    descriptor.addPrimaryKeyFieldName("CHARITY_ID");
    descriptor.setSequenceNumberName("CHARITY_SEQ");
    descriptor.setSequenceNumberFieldName("CHARITY_ID");

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

    descriptor.setShouldBeReadOnly(true);

    addDescriptor(descriptor);
  }
  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 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;
  }
  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);
  }
  protected void setup() {
    descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(ClassWithProblemConstructor.class);
    //   descriptor.setJavaClass(TargetInvocationWhileConstructorInstantiationOfFactoryTest.class);
    //  //no problems
    descriptor.addTableName("EMPLOYEE");
    policy = descriptor.getInstantiationPolicy();
    policy.setMethodName("method");
    policy.useFactoryInstantiationPolicy(ClassWithProblemConstructor.class, "method");

    orgIntegrityChecker = getSession().getIntegrityChecker();
    getSession().setIntegrityChecker(new IntegrityChecker()); // moved into setup
    getSession().getIntegrityChecker().dontCatchExceptions(); // moved into setup

    expectedException =
        DescriptorException.targetInvocationWhileConstructorInstantiationOfFactory(
            descriptor, new Exception());
  }
Ejemplo n.º 24
0
  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);
  }
Ejemplo n.º 25
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;
  }
Ejemplo n.º 26
0
  public ClassDescriptor buildSmallProjectDescriptor() {
    RelationalDescriptor descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(SmallProject.class);
    descriptor.addTableName("OTOJT_PROJECT");

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

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

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

    // Named Queries.
    // Event Manager.
    return descriptor;
  }
Ejemplo n.º 27
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);
  }
  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;
  }