org.jminor.framework.tools
Class EntityDataUtil

java.lang.Object
  extended by org.jminor.framework.tools.EntityDataUtil

public final class EntityDataUtil
extends Object

A static helper class for mass data manipulation.


Method Summary
static void batchInsert(EntityConnection connection, List<Entity> entities, List<Entity.Key> committed, int batchSize, ProgressReporter progressReporter)
          Inserts the given entities, performing a commit after each batchSize number of inserts.
static void copyEntities(EntityConnection source, EntityConnection destination, int batchSize, boolean includePrimaryKeys, String... entityIDs)
          Copies the given entities from source to destination
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copyEntities

public static void copyEntities(EntityConnection source,
                                EntityConnection destination,
                                int batchSize,
                                boolean includePrimaryKeys,
                                String... entityIDs)
                         throws DatabaseException
Copies the given entities from source to destination

Parameters:
source - the source db
destination - the destination db
batchSize - the number of records to copy between commits
includePrimaryKeys - if true primary key values are included, if false then they are assumed to be auto-generated
entityIDs - the ID's of the entity types to copy
Throws:
DatabaseException - in case of a db exception

batchInsert

public static void batchInsert(EntityConnection connection,
                               List<Entity> entities,
                               List<Entity.Key> committed,
                               int batchSize,
                               ProgressReporter progressReporter)
                        throws DatabaseException
Inserts the given entities, performing a commit after each batchSize number of inserts.

Parameters:
connection - the entity connection to use when inserting
entities - the entities to insert
committed - after the call this list will contain the primary keys of successfully inserted entities
batchSize - the commit batch size
progressReporter - if specified this will be used to report batch progress
Throws:
DatabaseException - in case of an exception