net.sf.hajdbc.sync
Class FullSynchronizationStrategy
java.lang.Object
net.sf.hajdbc.sync.FullSynchronizationStrategy
- All Implemented Interfaces:
- SynchronizationStrategy
public class FullSynchronizationStrategy
- extends Object
- implements SynchronizationStrategy
Database-independent synchronization strategy that only updates differences between two databases.
This strategy is best used when there are many differences between the active database and the inactive database (i.e. very much out of sync).
The following algorithm is used:
- Drop the foreign keys on the inactive database (to avoid integrity constraint violations)
- For each database table:
- Delete all rows in the inactive database table
- Query all rows on the active database table
- For each row in active database table:
- Insert new row into inactive database table
- Re-create the foreign keys on the inactive database
- Synchronize sequences
- Author:
- Paul Ferraro
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FullSynchronizationStrategy
public FullSynchronizationStrategy()
synchronize
public <D> void synchronize(SynchronizationContext<D> context)
throws SQLException
- Description copied from interface:
SynchronizationStrategy
- Synchronizes a target database with a source database as defined by the synchronization context.
- Specified by:
synchronize in interface SynchronizationStrategy
- Parameters:
context - a synchronization context
- Throws:
SQLException - if synchronization fails- See Also:
SynchronizationStrategy.synchronize(net.sf.hajdbc.SynchronizationContext)
getFetchSize
public int getFetchSize()
- Returns:
- the fetchSize.
setFetchSize
public void setFetchSize(int fetchSize)
- Parameters:
fetchSize - the fetchSize to set.
getMaxBatchSize
public int getMaxBatchSize()
- Returns:
- the maxBatchSize.
setMaxBatchSize
public void setMaxBatchSize(int maxBatchSize)
- Parameters:
maxBatchSize - the maxBatchSize to set.