Search in sources :

Example 1 with HistoricalDatabaseTable

use of org.eclipse.persistence.internal.history.HistoricalDatabaseTable in project eclipselink by eclipse-ee4j.

the class HistoryPolicy method verifyTableQualifiers.

/**
 * INTERNAL: Check that the qualifiers on the historical tables are
 * properly set.
 * <p>A similar method exists on ClassDescriptor.
 */
protected void verifyTableQualifiers(DatasourcePlatform platform) {
    String tableQualifier = platform.getTableQualifier();
    if (tableQualifier.length() == 0) {
        return;
    }
    for (DatabaseTable table : getHistoricalTables()) {
        // Build a scratch table to see if history table name has a qualifier.
        DatabaseTable scratchTable = new DatabaseTable(table.getQualifiedName());
        if (scratchTable.getTableQualifier().length() == 0) {
            scratchTable.setTableQualifier(tableQualifier);
            ((HistoricalDatabaseTable) table).setHistoricalName(scratchTable.getQualifiedNameDelimited(platform));
        }
    }
}
Also used : DatabaseTable(org.eclipse.persistence.internal.helper.DatabaseTable) HistoricalDatabaseTable(org.eclipse.persistence.internal.history.HistoricalDatabaseTable) HistoricalDatabaseTable(org.eclipse.persistence.internal.history.HistoricalDatabaseTable)

Example 2 with HistoricalDatabaseTable

use of org.eclipse.persistence.internal.history.HistoricalDatabaseTable in project eclipselink by eclipse-ee4j.

the class HistoryPolicy method addHistoryTableName.

/**
 * PUBLIC:
 * Use to specify the names of the mirroring historical tables.
 * <p>
 * Explicitly states that <code>sourceTableName</code> is mirrored by history table
 * <code>historyTableName</code>.
 * The order in which tables are added with descriptor.addTableName()
 * should still match the order in which mirroring historical tables are
 * added with descriptor.addMirroringHistoryTableName().
 */
public void addHistoryTableName(String sourceTableName, String historyTableName) {
    if ((sourceTableName == null) || sourceTableName.equals("")) {
        addHistoryTableName(historyTableName);
    }
    HistoricalDatabaseTable table = new HistoricalDatabaseTable(sourceTableName);
    table.setHistoricalName(historyTableName);
    // Note that the equality check is only on sourceTableName, not historyTableName.
    int index = getHistoricalTables().indexOf(table);
    if (index == -1) {
        getHistoricalTables().add(table);
    } else {
        getHistoricalTables().set(index, table);
    }
}
Also used : HistoricalDatabaseTable(org.eclipse.persistence.internal.history.HistoricalDatabaseTable)

Aggregations

HistoricalDatabaseTable (org.eclipse.persistence.internal.history.HistoricalDatabaseTable)2 DatabaseTable (org.eclipse.persistence.internal.helper.DatabaseTable)1