/** * Use the definition object to drop and recreate the schema entity on the database. * This is used for dropping tables, views, procedures ... etc ... * This handles and ignore any database error while dropping in case the object did not previously exist. */ public void replaceObject(DatabaseObjectDefinition databaseDefinition) throws EclipseLinkException { // PERF: Allow a special "fast" flag to be set on the session causes a delete from the table instead of a replace. boolean fast = FAST_TABLE_CREATOR; if (fast && (databaseDefinition instanceof TableDefinition)) { session.executeNonSelectingSQL("DELETE FROM " + databaseDefinition.getName()); } else if (fast && (databaseDefinition instanceof StoredProcedureDefinition)) { // do nothing } else { // CR 3870467, do not log stack boolean shouldLogExceptionStackTrace = getSession().getSessionLog().shouldLogExceptionStackTrace(); if (shouldLogExceptionStackTrace) { getSession().getSessionLog().setShouldLogExceptionStackTrace(false); } try { dropObject(databaseDefinition); } catch (DatabaseException exception) { // Ignore error } finally { if (shouldLogExceptionStackTrace) { getSession().getSessionLog().setShouldLogExceptionStackTrace(true); } } createObject(databaseDefinition); } }
/** * Use the definition object to drop and recreate the schema entity on the database. * This is used for dropping tables, views, procedures ... etc ... * This handles and ignore any database error while droping incase the object did not previously exist. */ public void replaceObject(DatabaseObjectDefinition databaseDefinition) throws EclipseLinkException { // PERF: Allow a special "fast" flag to be set on the session causes a delete from the table instead of a replace. boolean fast = FAST_TABLE_CREATOR; if (fast && (databaseDefinition instanceof TableDefinition)) { session.executeNonSelectingSQL("DELETE FROM " + databaseDefinition.getName()); } else { // CR 3870467, do not log stack boolean shouldLogExceptionStackTrace = getSession().getSessionLog().shouldLogExceptionStackTrace(); if (shouldLogExceptionStackTrace) { getSession().getSessionLog().setShouldLogExceptionStackTrace(false); } try { dropObject(databaseDefinition); } catch (DatabaseException exception) { // Ignore error } finally { if (shouldLogExceptionStackTrace) { getSession().getSessionLog().setShouldLogExceptionStackTrace(true); } } createObject(databaseDefinition); } }
session.executeNonSelectingSQL("DELETE FROM " + databaseDefinition.getName()); } else if (fast && (databaseDefinition instanceof StoredProcedureDefinition)) {