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;
  }
Ejemplo n.º 2
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 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.º 4
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;
  }
  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;
  }
Ejemplo n.º 6
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 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;
  }