Search in sources :

Example 1 with HibernateJdbcException

use of org.springframework.orm.hibernate5.HibernateJdbcException in project spring-batch by spring-projects.

the class HibernateFailureJobFunctionalTests method testLaunchJob.

@Test
public void testLaunchJob() throws Exception {
    validatePreConditions();
    JobParameters params = new JobParametersBuilder().addString("key", "failureJob").toJobParameters();
    writer.setFailOnFlush(2);
    try {
        jobLauncherTestUtils.launchJob(params);
    } catch (HibernateJdbcException e) {
        // RepeatContext:
        throw e;
    } catch (UncategorizedSQLException e) {
        // assertEquals(1, writer.getErrors().size());
        throw e;
    }
    int after = JdbcTestUtils.countRowsInTable(jdbcTemplate, "CUSTOMER");
    assertEquals(4, after);
    validatePostConditions();
}
Also used : UncategorizedSQLException(org.springframework.jdbc.UncategorizedSQLException) JobParametersBuilder(org.springframework.batch.core.JobParametersBuilder) HibernateJdbcException(org.springframework.orm.hibernate5.HibernateJdbcException) JobParameters(org.springframework.batch.core.JobParameters) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 JobParameters (org.springframework.batch.core.JobParameters)1 JobParametersBuilder (org.springframework.batch.core.JobParametersBuilder)1 UncategorizedSQLException (org.springframework.jdbc.UncategorizedSQLException)1 HibernateJdbcException (org.springframework.orm.hibernate5.HibernateJdbcException)1