public static boolean supportsStoredFunctions(String puName) { DatabasePlatform platform = getDatabaseSession(puName).getPlatform(); // PostgreSQL has some level of support for "stored functions", but output parameters do not // work as of 8.2. // TODO: DB2 should be in this list. if (platform.isOracle() || platform.isMySQL()) { return true; } warning("This database does not support stored function creation."); return false; }
public static boolean supportsStoredProcedures(String puName) { DatabasePlatform platform = getDatabaseSession(puName).getPlatform(); // PostgreSQL has some level of support for "stored functions", but output parameters do not // work as of 8.2. // Sybase supports stored procedures, but has issues with output parameters and transaction mode // (INOUT and chaining). // TODO: DB2 should be in this list. if (platform.isOracle() || platform.isMySQL() || platform.isSQLServer()) { return true; } warning("This database does not support stored procedure creation."); return false; }
protected static void afterAddDescriptors(Session session, TestSystem aTestSystem) { if (aTestSystem instanceof InheritanceSystem) { // For using read all subclasses views. org.eclipse.persistence.internal.databaseaccess.DatabasePlatform platform = session.getLogin().getPlatform(); if (platform.isOracle() || platform.isSybase() || platform.isSQLAnywhere()) { ClassDescriptor computerDescriptor = session.getClassDescriptor(Computer.class); ClassDescriptor vehicleDescriptor = session.getClassDescriptor(Vehicle.class); if (computerDescriptor.getInheritancePolicy().requiresMultipleTableSubclassRead()) { computerDescriptor.getInheritancePolicy().setReadAllSubclassesViewName("AllComputers"); } if (vehicleDescriptor.getInheritancePolicy().requiresMultipleTableSubclassRead()) { vehicleDescriptor.getInheritancePolicy().setReadAllSubclassesViewName("AllVehicles"); } } } }
/** 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); }