Methods Summary |
---|
public void | addTableDefinition(oracle.toplink.essentials.tools.schemaframework.TableDefinition tableDefinition)Add the table.
tableDefinitions.addElement(tableDefinition);
|
public void | addTableDefinitions(java.util.Collection tableDefs)Add a set of tables.
tableDefinitions.addAll(tableDefs);
|
public void | createConstraints(oracle.toplink.essentials.sessions.DatabaseSession session)Create constraints.
//CR2612669
createConstraints(session, new SchemaManager(session));
|
public void | createConstraints(oracle.toplink.essentials.sessions.DatabaseSession session, oracle.toplink.essentials.tools.schemaframework.SchemaManager schemaManager)Create constraints.
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;
}
}
}
|
public void | createTables(oracle.toplink.essentials.sessions.DatabaseSession session)This creates the tables on the database.
If the table already exists this will fail.
//CR2612669
createTables(session, new SchemaManager(session));
|
public void | createTables(oracle.toplink.essentials.sessions.DatabaseSession session, oracle.toplink.essentials.tools.schemaframework.SchemaManager schemaManager)This creates the tables on the database.
If the table already exists this will fail.
for (Enumeration enumtr = getTableDefinitions().elements(); enumtr.hasMoreElements();) {
schemaManager.buildFieldTypes((TableDefinition)enumtr.nextElement());
}
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.createObject(table);
session.getSessionLog().log(SessionLog.FINEST, "default_tables_created", table.getFullName());
} catch (DatabaseException ex) {
session.getSessionLog().log(SessionLog.FINEST, "default_tables_already_existed", table.getFullName());
if (!shouldIgnoreDatabaseException()) {
throw ex;
}
}
}
}
// 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;
}
}
}
schemaManager.createSequences();
|
public void | dropConstraints(oracle.toplink.essentials.sessions.DatabaseSession session, oracle.toplink.essentials.tools.schemaframework.SchemaManager schemaManager)Drop the table constraints from the database.
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 (oracle.toplink.essentials.exceptions.DatabaseException dbE) {
//ignore
}
}
|
public void | dropConstraints(oracle.toplink.essentials.sessions.DatabaseSession session)Drop the table constraints from the database.
//CR2612669
dropConstraints(session, new SchemaManager(session));
|
public void | dropTables(oracle.toplink.essentials.sessions.DatabaseSession session)Drop the tables from the database.
//CR2612669
dropTables(session, new SchemaManager(session));
|
public void | dropTables(oracle.toplink.essentials.sessions.DatabaseSession session, oracle.toplink.essentials.tools.schemaframework.SchemaManager schemaManager)Drop the tables from the database.
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 (oracle.toplink.essentials.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;
}
}
}
}
|
public java.lang.String | getName()Return the name.
return name;
|
protected java.lang.String | getSequenceTableName(oracle.toplink.essentials.sessions.Session session)
String sequenceTableName = null;
if (session.getProject().usesSequencing()) {
oracle.toplink.essentials.sequencing.Sequence sequence = session.getLogin().getDefaultSequence();
if (sequence instanceof oracle.toplink.essentials.sequencing.TableSequence) {
sequenceTableName = ((oracle.toplink.essentials.sequencing.TableSequence)sequence).getTableName();
}
}
return sequenceTableName;
|
public java.util.Vector | getTableDefinitions()Return the tables.
return tableDefinitions;
|
public void | replaceTables(oracle.toplink.essentials.sessions.DatabaseSession session)Recreate the tables on the database.
This will drop the tables if they exist and recreate them.
replaceTables(session, new SchemaManager(session));
|
public void | replaceTables(oracle.toplink.essentials.sessions.DatabaseSession session, oracle.toplink.essentials.tools.schemaframework.SchemaManager schemaManager)Recreate the tables on the database.
This will drop the tables if they exist and recreate them.
replaceTablesAndConstraints(schemaManager, session);
schemaManager.createSequences();
|
public void | replaceTables(oracle.toplink.essentials.sessions.DatabaseSession session, oracle.toplink.essentials.tools.schemaframework.SchemaManager schemaManager, boolean keepSequenceTable)Recreate the tables on the database.
This will drop the tables if they exist and recreate them.
replaceTablesAndConstraints(schemaManager, session);
schemaManager.createOrReplaceSequences(keepSequenceTable, false);
|
private void | replaceTablesAndConstraints(oracle.toplink.essentials.tools.schemaframework.SchemaManager schemaManager, oracle.toplink.essentials.sessions.DatabaseSession session)
for (Enumeration enumtr = getTableDefinitions().elements(); enumtr.hasMoreElements();) {
schemaManager.buildFieldTypes((TableDefinition)enumtr.nextElement());
}
// CR 3870467, do not log stack
boolean shouldLogExceptionStackTrace = session.getSessionLog().shouldLogExceptionStackTrace();
if (shouldLogExceptionStackTrace) {
session.getSessionLog().setShouldLogExceptionStackTrace(false);
}
try {
for (Enumeration enumtr = getTableDefinitions().elements(); enumtr.hasMoreElements();) {
try {
schemaManager.dropConstraints((TableDefinition)enumtr.nextElement());
} catch (oracle.toplink.essentials.exceptions.DatabaseException dbE) {
//ignore
}
}
} finally {
if (shouldLogExceptionStackTrace) {
session.getSessionLog().setShouldLogExceptionStackTrace(true);
}
}
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.replaceObject(table);
} catch (DatabaseException ex) {
if (!shouldIgnoreDatabaseException()) {
throw ex;
}
}
}
}
// 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;
}
}
}
|
void | setIgnoreDatabaseException(boolean ignoreDatabaseException)Set flag whether DatabaseException should be ignored.
this.ignoreDatabaseException = ignoreDatabaseException;
|
public void | setName(java.lang.String name)Set the name.
this.name = name;
|
public void | setTableDefinitions(java.util.Vector tableDefinitions)Set the tables.
this.tableDefinitions = tableDefinitions;
|
boolean | shouldIgnoreDatabaseException()Return true if DatabaseException is to be ignored.
return ignoreDatabaseException;
|