public void createTables(DatabaseSession session) {
    dropTableConstraints(session);
    new InheritanceTableCreator().replaceTables(session);

    SchemaManager schemaManager = new SchemaManager(session);
    if (session.getLogin().getPlatform().isOracle()) {
      schemaManager.replaceObject(Computer.oracleView());
      schemaManager.replaceObject(Vehicle.oracleView());
    } else if (session.getLogin().getPlatform().isSybase()) {
      schemaManager.replaceObject(Computer.sybaseView());
      schemaManager.replaceObject(Vehicle.sybaseView());
      // CREATE VIEW statement was added in MySQL 5.0.1.  Uncomment it when we support MySQL 5
      // } else if (session.getLogin().getPlatform().isMySQL()) {
      // schemaManager.replaceObject(Computer.sybaseView());
      // schemaManager.replaceObject(Vehicle.mySQLView());
    }
  }
  /** Also creates the procs. */
  public void createTables(DatabaseSession session) {
    super.createTables(session);
    org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform =
        session.getLogin().getPlatform();
    SchemaManager schema = new SchemaManager((session));

    if (platform.isSQLServer()) {}

    if (platform.isSybase() || platform.isSQLAnywhere()) {}
    if (platform.isOracle()) {

      schema.replaceObject(buildOracleStoredProcedureInsertPolicyHolders());
      schema.replaceObject(buildOracleStoredProcedureReadFromPolicyHolders());
      schema.replaceObject(buildOracleStoredProcedureDeletePolicyHolders());
    }
    if (platform.isDB2()) {}
  }
  public void addDescriptors(DatabaseSession session) {
    // Oracle has bug in outjoins that require outerjoin of inheritance type.
    // This should really be handled by the platform during expression normalization...
    // Id for Entomologist can be negative (millis cast to int wraps...)
    project.getDescriptor(Entomologist.class).setIdValidation(IdValidation.NONE);

    session.addDescriptors(project);

    // For using read all subclasses views.
    DatabasePlatform platform = session.getLogin().getPlatform();
    if (platform.isOracle() || platform.isSybase()) {
      ClassDescriptor computerDescriptor = session.getDescriptor(Computer.class);
      ClassDescriptor vehicleDescriptor = session.getDescriptor(Vehicle.class);
      computerDescriptor.getInheritancePolicy().setReadAllSubclassesViewName("AllComputers");
      vehicleDescriptor.getInheritancePolicy().setReadAllSubclassesViewName("AllVehicles");
    }

    // Enable outer-join on AnimalMatt hierarchy.
    session
        .getDescriptor(Animal_Matt.class)
        .getInheritancePolicy()
        .setShouldOuterJoinSubclasses(true);
  }
  public void addDescriptors(DatabaseSession session) {
    if (project == null) {
      if (getAdapter().isOriginalSetupRequired()) {
        try {
          // If called twice, method TestSystem.addDescriptors(Session)
          // may behave wrong during the second call
          // (typically because during the second call project value is no longer null,
          // which causes problems in case more than one project is used).
          // Therefore another instance of TestSystem is created - not to spoil the original.
          TestSystem tempTestSystem = getTestSystem().getClass().newInstance();
          tempTestSystem.addDescriptors(session);
          try {
            tempTestSystem.createTables(session);
          } catch (Exception ex2) {
            throw new TestProblemException(
                "Exception thrown by "
                    + Helper.getShortClassName(tempTestSystem)
                    + ".createTables() ",
                ex2);
          }
        } catch (Exception ex1) {
          throw new TestProblemException(
              "Failed to create an instance of " + getTestSystem().getClass() + " ", ex1);
        }
      }
      // This trick stores all descriptors used by testSystem into project
      DatabaseSession dummyDatabaseSession =
          new Project((Login) session.getLogin().clone()).createDatabaseSession();
      getTestSystem().addDescriptors(dummyDatabaseSession);
      project = dummyDatabaseSession.getProject();

      getAdapter().updateProject(project, session);
    }
    (session).addDescriptors(project);
    afterAddDescriptors(session, getTestSystem());
  }