/** * Create constraints. */ public void createConstraints(List<TableDefinition> tables, DatabaseSession session, SchemaManager schemaManager, boolean build) { buildConstraints(schemaManager, build); // Unique constraints should be generated before foreign key constraints, // because foreign key constraints can reference unique constraints for (TableDefinition table : tables) { try { schemaManager.createUniqueConstraints(table); } catch (DatabaseException ex) { if (!shouldIgnoreDatabaseException()) { throw ex; } } } for (TableDefinition table : tables) { try { schemaManager.createForeignConstraints(table); } catch (DatabaseException ex) { if (!shouldIgnoreDatabaseException()) { throw ex; } } } }
/** * Create constraints. */ public void createConstraints(List<TableDefinition> tables, DatabaseSession session, SchemaManager schemaManager, boolean build) { buildConstraints(schemaManager, build); // Unique constraints should be generated before foreign key constraints, // because foreign key constraints can reference unique constraints for (TableDefinition table : tables) { try { schemaManager.createUniqueConstraints(table); } catch (DatabaseException ex) { if (!shouldIgnoreDatabaseException()) { throw ex; } } } for (TableDefinition table : tables) { try { schemaManager.createForeignConstraints(table); } catch (DatabaseException ex) { if (!shouldIgnoreDatabaseException()) { throw ex; } } } }
/** * Create constraints. */ public void createConstraints(org.eclipse.persistence.sessions.DatabaseSession session, SchemaManager schemaManager) { for (Enumeration enumtr = getTableDefinitions().elements(); enumtr.hasMoreElements();) { schemaManager.buildFieldTypes((TableDefinition)enumtr.nextElement()); } // Unique constraints should be generated before foreign key constraints, // because foreign key constraints can reference unique constraints for (Enumeration enumtr = getTableDefinitions().elements(); enumtr.hasMoreElements();) { try { schemaManager.createUniqueConstraints((TableDefinition)enumtr.nextElement()); } catch (DatabaseException ex) { if (!shouldIgnoreDatabaseException()) { throw ex; } } } for (Enumeration enumtr = getTableDefinitions().elements(); enumtr.hasMoreElements();) { try { schemaManager.createForeignConstraints((TableDefinition)enumtr.nextElement()); } catch (DatabaseException ex) { if (!shouldIgnoreDatabaseException()) { throw ex; } } } }
/** * Drop the tables from the database. */ public void dropTables(org.eclipse.persistence.sessions.DatabaseSession session, SchemaManager schemaManager) { for (Enumeration enumtr = getTableDefinitions().elements(); enumtr.hasMoreElements();) { schemaManager.buildFieldTypes((TableDefinition)enumtr.nextElement()); } for (Enumeration enumtr = getTableDefinitions().elements(); enumtr.hasMoreElements();) { try { schemaManager.dropConstraints((TableDefinition)enumtr.nextElement()); } catch (org.eclipse.persistence.exceptions.DatabaseException dbE) { //ignore } } String sequenceTableName = getSequenceTableName(session); for (Enumeration enumtr = getTableDefinitions().elements(); enumtr.hasMoreElements();) { // Must not create sequence table as done in createSequences. TableDefinition table = (TableDefinition)enumtr.nextElement(); if (!table.getName().equals(sequenceTableName)) { try { schemaManager.dropObject(table); } catch (DatabaseException ex) { if (!shouldIgnoreDatabaseException()) { throw ex; } } } } }
protected void extendTablesAndConstraints(SchemaManager schemaManager, DatabaseSession session) { buildConstraints(schemaManager, true); boolean ignore = shouldIgnoreDatabaseException(); setIgnoreDatabaseException(true); try { extendTables(session, schemaManager, false); } finally { setIgnoreDatabaseException(ignore); } }
protected void extendTablesAndConstraints(SchemaManager schemaManager, DatabaseSession session) { buildConstraints(schemaManager, true); boolean ignore = shouldIgnoreDatabaseException(); setIgnoreDatabaseException(true); try { extendTables(session, schemaManager, false); } finally { setIgnoreDatabaseException(ignore); } }
} catch (DatabaseException ex) { session.getSessionLog().log(SessionLog.FINEST, "default_tables_already_existed", table.getFullName()); if (!shouldIgnoreDatabaseException()) { throw ex; schemaManager.createUniqueConstraints((TableDefinition)enumtr.nextElement()); } catch (DatabaseException ex) { if (!shouldIgnoreDatabaseException()) { throw ex; schemaManager.createForeignConstraints((TableDefinition)enumtr.nextElement()); } catch (DatabaseException ex) { if (!shouldIgnoreDatabaseException()) { throw ex;
protected void replaceTablesAndConstraints(SchemaManager schemaManager, DatabaseSession session, boolean createSequenceTables, boolean createSequences) { buildConstraints(schemaManager, true); boolean ignore = shouldIgnoreDatabaseException(); setIgnoreDatabaseException(true); try { dropTables(session, schemaManager, false); } finally { setIgnoreDatabaseException(ignore); } createTables(session, schemaManager, false, false, createSequenceTables, createSequences); }
protected void replaceTablesAndConstraints(SchemaManager schemaManager, DatabaseSession session, boolean createSequenceTables, boolean createSequences) { buildConstraints(schemaManager, true); boolean ignore = shouldIgnoreDatabaseException(); setIgnoreDatabaseException(true); try { dropTables(session, schemaManager, false); } finally { setIgnoreDatabaseException(ignore); } createTables(session, schemaManager, false, false, createSequenceTables, createSequences); }
schemaManager.replaceObject(table); } catch (DatabaseException ex) { if (!shouldIgnoreDatabaseException()) { throw ex; schemaManager.createUniqueConstraints((TableDefinition)enumtr.nextElement()); } catch (DatabaseException ex) { if (!shouldIgnoreDatabaseException()) { throw ex; schemaManager.createForeignConstraints((TableDefinition)enumtr.nextElement()); } catch (DatabaseException ex) { if (!shouldIgnoreDatabaseException()) { throw ex;
} catch (DatabaseException ex) { session.getSessionLog().log(SessionLog.FINEST, SessionLog.DDL, "default_tables_already_existed", table.getFullName()); if (!shouldIgnoreDatabaseException()) { throw ex;
} catch (DatabaseException ex) { session.getSessionLog().log(SessionLog.FINEST, SessionLog.DDL, "default_tables_already_existed", table.getFullName()); if (!shouldIgnoreDatabaseException()) { throw ex;
} catch (DatabaseException exception) { failed.add(table); if (!shouldIgnoreDatabaseException()) { throw exception;
} catch (DatabaseException exception) { failed.add(table); if (!shouldIgnoreDatabaseException()) { throw exception;
} catch(DatabaseException addFieldEx) { session.getSessionLog().log(SessionLog.FINEST, SessionLog.DDL, "table_cannot_add_field", dbField.getName(), table.getFullName(), addFieldEx.getMessage()); if (!shouldIgnoreDatabaseException()) { throw addFieldEx; if (!shouldIgnoreDatabaseException()) { throw createTableException;
} catch(DatabaseException addFieldEx) { session.getSessionLog().log(SessionLog.FINEST, SessionLog.DDL, "table_cannot_add_field", dbField.getName(), table.getFullName(), addFieldEx.getMessage()); if (!shouldIgnoreDatabaseException()) { throw addFieldEx; if (!shouldIgnoreDatabaseException()) { throw createTableException;