Top Description Methods
org.springframework.jdbc.datasource.init

public Interface DatabasePopulator

Known Direct Implementers
org.springframework.jdbc.datasource.init.ResourceDatabasePopulator, org.springframework.jdbc.datasource.init.CompositeDatabasePopulator
Annotations
@FunctionalInterface
Imports
java.sql.Connection, .SQLException

Strategy used to populate, initialize, or clean up a database.
Authors
Keith Donald, Sam Brannen
Since
3.0
See Also
ResourceDatabasePopulator, DatabasePopulatorUtils, DataSourceInitializer

Method Summary

Modifier and TypeMethod and Description
public void
populate(Connection
the JDBC connection to use; already configured and ready to use; never null
connection
)

Populate, initialize, or clean up the database using the provided JDBC connection.

Method Detail

populateback to summary
public void populate(Connection connection) throws SQLException, ScriptException

Populate, initialize, or clean up the database using the provided JDBC connection.

Warning

Concrete implementations should not close the provided Connection.

Concrete implementations may throw an SQLException if an error is encountered but are strongly encouraged to throw a specific ScriptException instead. For example, Spring's ResourceDatabasePopulator and DatabasePopulatorUtils wrap all SQLExceptions in ScriptExceptions.

Parameters
connection:Connection

the JDBC connection to use; already configured and ready to use; never null

Exceptions
SQLException:
if an unrecoverable data access exception occurs while interacting with the database
ScriptException:
in all other error cases
See Also
DatabasePopulatorUtils#execute