Subclass of AbstractTransactionalSpringContextTests that adds some convenience
functionality for JDBC access. Expects a DataSource bean
to be defined in the Spring application context.
This class exposes a JdbcTemplate
and provides an easy way to delete from the database in a new transaction.
getJdbcTemplate()
Return the JdbcTemplate that this base class manages.
protected void
setComplete()
Overridden to prevent the transaction committing if a number of tables have been
cleared, as a defensive measure against accidental permanent wiping of a database.
void
setDataSource(DataSource dataSource)
Setter: DataSource is provided by Dependency Injection.
Overridden to prevent the transaction committing if a number of tables have been
cleared, as a defensive measure against accidental permanent wiping of a database.
Execute the given SQL script. Will be rolled back by default,
according to the fate of the current transaction.
Parameters:
sqlResourcePath - Spring resource path for the SQL script.
Should normally be loaded by classpath. There should be one statement
per line. Any semicolons will be removed.
Do not use this method to execute DDL if you expect rollback.
continueOnError - whether or not to continue without throwing
an exception in the event of an error
Throws:
DataAccessException - if there is an error executing a statement
and continueOnError was false