use of org.eclipse.persistence.internal.databaseaccess.DatabasePlatform in project eclipselink by eclipse-ee4j.
the class JPAMetadataGenerator method loadDatabasePlatform.
/**
* Attempt to load the DatabasePlatform using the given platform class name. If the
* platform cannot be loaded Oracle11Platform will be returned - if available.
*
* @param platformClassName class name of the DatabasePlatform to be loaded
* @return DatabasePlatform loaded for the given platformClassname, or Oracle11Platform if not found
* @see "org.eclipse.persistence.platform.database.oracle.Oracle11Platform"
*/
public static DatabasePlatform loadDatabasePlatform(String platformClassName) {
DatabasePlatform dbPlatform = null;
Class<?> platformClass = null;
try {
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
platformClass = AccessController.doPrivileged(new PrivilegedClassForName<>(platformClassName));
} else {
platformClass = PrivilegedAccessHelper.getClassForName(platformClassName);
}
dbPlatform = (DatabasePlatform) Helper.getInstanceFromClass(platformClass);
} catch (PrivilegedActionException | ClassNotFoundException | NullPointerException e) {
try {
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
platformClass = AccessController.doPrivileged(new PrivilegedClassForName<>(DEFAULT_PLATFORM));
} else {
platformClass = PrivilegedAccessHelper.getClassForName(DEFAULT_PLATFORM);
}
dbPlatform = (DatabasePlatform) Helper.getInstanceFromClass(platformClass);
} catch (PrivilegedActionException | ClassNotFoundException ex) {
// at this point we can't load the default Oracle11Platform, so null will be returned
}
}
return dbPlatform;
}
use of org.eclipse.persistence.internal.databaseaccess.DatabasePlatform in project eclipselink by eclipse-ee4j.
the class JUnitTestCase method supportsStoredProcedures.
public static boolean supportsStoredProcedures(String puName) {
DatabasePlatform platform = getDatabaseSession(puName).getPlatform();
// 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;
}
Aggregations