/** INTERNAL: Return the create table statement. */
 public Writer buildCreationWriter(AbstractSession session, Writer writer)
     throws ValidationException {
   try {
     DatabasePlatform platform = session.getPlatform();
     writer.write("CREATE PACKAGE " + getFullName());
     writer.write(" AS");
     writer.write("\n");
     for (Enumeration statementsEnum = getStatements().elements();
         statementsEnum.hasMoreElements(); ) {
       writer.write((String) statementsEnum.nextElement());
       writer.write(platform.getBatchDelimiterString());
       writer.write("\n");
     }
     for (Enumeration proceduresEnum = getProcedures().elements();
         proceduresEnum.hasMoreElements(); ) {
       writer.write("\n");
       String procedureString =
           ((StoredProcedureDefinition) proceduresEnum.nextElement())
               .buildCreationWriter(session, writer)
               .toString();
       writer.write(procedureString.substring(7, procedureString.length()));
       writer.write("\n");
     }
     writer.write(platform.getBatchEndString());
     writer.write("\n" + session.getPlatform().getStoredProcedureTerminationToken());
   } catch (IOException ioException) {
     throw ValidationException.fileError(ioException);
   }
   return writer;
 }
  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);
  }