title: jdbcTemplate.batchUpdate not inserting rows
body: <p>I'm trying to do a batch insert, but when run in Tomcat the app seems to hang, and no new rows inserted. Below is my code:</p>
  
  <pre><code>public class MatchDAOImpl implements MatchDAO {
  
      private JdbcTemplate jdbcTemplate;
  
      public MatchDAOImpl(DataSource dataSource) {
          jdbcTemplate = new JdbcTemplate(dataSource);
      }
  
      @Override
      public void batchInsert(final List&lt;Match&gt; matches){
  
          String sql = "INSERT INTO matches (id, status, home_team_id, away_team_id, home_goals, away_goals) VALUES (?, ?, ?, ?, ?, ?)";
  
          jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
  
              @Override
              public void setValues(PreparedStatement ps, int i) throws SQLException {
                  Match match = matches.get(i);
                  System.out.println("Inserting values for #" + match.getId());
                  ps.setInt(1, match.getId());
                  ps.setString(2, match.getStatus());
                  ps.setInt(3, match.getHomeTeam().getId());
                  ps.setInt(4, match.getAwayTeam().getId());
                  ps.setInt(5, match.getHomeGoals());
                  ps.setInt(6, match.getAwayGoals());
              }
  
              @Override
              public int getBatchSize() {
                  return matches.size();
              }
          });
      }
  </code></pre>
  
  <p>Here is an example of it being called:</p>
  
  <pre><code>matchesDAO.batchInsert(matches);
  </code></pre>
  
  <p>Also, you'll see I have a println command so I know that it's at least using this method. Below is a sample output from this:</p>
  
  <pre><code>Inserting values for #233398
  Inserting values for #233399
  Inserting values for #233400
  Inserting values for #233401
  Inserting values for #233402
  ...
  </code></pre>
  
  <p>However, when I check the database for any new rows there are none (empty table). I'm not getting any exception thrown to indicate what the issue is. Does my method look OK?</p>
  
  <p>UPDATE</p>
  
  <p>MvcConfig.java</p>
  
  <pre><code>@Configuration
  @ComponentScan(basePackages="com.example.budget")
  @EnableWebMvc
  public class MvcConfiguration extends WebMvcConfigurerAdapter{
  
      //...
  
      @Bean
      public DataSource getDataSource() {
          DriverManagerDataSource dataSource = new DriverManagerDataSource();
  //      dataSource.setDriverClassName("oracle.jdbc.driver.OracleDriver");
          dataSource.setDriverClassName( OracleDriver.class.getName() );
          dataSource.setUrl("jdbc:oracle:thin:@localhost:1521:xe");
          dataSource.setUsername("budget_admin");
          dataSource.setPassword("budg3t");
  
          return dataSource;
      }
  
      @Bean
      public MatchDAO getMatchDAO() {
          return new MatchDAOImpl(getDataSource());
      }
  </code></pre>
  
  <p>Here is where batchInsert is being called for now:</p>
  
  <pre><code>@Controller
  public class MatchesController {
  
      @Autowired
      private FootballData footballData;
  
      @Autowired 
      private MatchDAO matchDAOImpl;
  
      @RequestMapping(value = "/api/matches")
      public ModelAndView matches(ModelAndView model) {
  
          List&lt;Match&gt; matches = footballData.requestMatches();
  
          // write to db
          matchDAOImpl.batchInsert(matches);
  
          model.addObject("matches", matches);
          model.setViewName("matches");
  
          return model;
      }
  </code></pre>