Class CompositeDatabasePopulator
java.lang.Object
org.springframework.jdbc.datasource.init.CompositeDatabasePopulator
- All Implemented Interfaces:
- DatabasePopulator
Composite 
DatabasePopulator that delegates to a list of given
 DatabasePopulator implementations, executing all scripts.- Since:
- 3.1
- Author:
- Dave Syer, Juergen Hoeller, Sam Brannen, Kazuki Shimizu
- 
Constructor SummaryConstructorsConstructorDescriptionCreate an emptyCompositeDatabasePopulator.CompositeDatabasePopulator(Collection<DatabasePopulator> populators) Create aCompositeDatabasePopulatorwith the given populators.CompositeDatabasePopulator(DatabasePopulator... populators) Create aCompositeDatabasePopulatorwith the given populators.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddPopulators(DatabasePopulator... populators) Add one or more populators to the list of delegates.voidpopulate(Connection connection) Populate, initialize, or clean up the database using the provided JDBC connection.voidsetPopulators(DatabasePopulator... populators) Specify one or more populators to delegate to.
- 
Constructor Details- 
CompositeDatabasePopulatorpublic CompositeDatabasePopulator()Create an emptyCompositeDatabasePopulator.
- 
CompositeDatabasePopulatorCreate aCompositeDatabasePopulatorwith the given populators.- Parameters:
- populators- one or more populators to delegate to
- Since:
- 4.3
 
- 
CompositeDatabasePopulatorCreate aCompositeDatabasePopulatorwith the given populators.- Parameters:
- populators- one or more populators to delegate to
- Since:
- 4.3
 
 
- 
- 
Method Details- 
setPopulatorsSpecify one or more populators to delegate to.
- 
addPopulatorsAdd one or more populators to the list of delegates.
- 
populateDescription copied from interface:DatabasePopulatorPopulate, initialize, or clean up the database using the provided JDBC connection.Concrete implementations may throw an SQLExceptionif an error is encountered but are strongly encouraged to throw a specificScriptExceptioninstead. For example, Spring'sResourceDatabasePopulatorandDatabasePopulatorUtilswrap allSQLExceptionsinScriptExceptions.- Specified by:
- populatein interface- DatabasePopulator
- Parameters:
- connection- the JDBC connection to use to populate the db; already configured and ready to use; never- null
- Throws:
- SQLException- if an unrecoverable data access exception occurs during database population
- ScriptException- in all other error cases
- See Also:
 
 
-