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); }