title: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'spring_batch_tutorial.batch_job_execution_params' doesn't exist - Spring Batch
body: <p>I am working on Spring MVC+ Spring Batch example, I'm developing an application from link: <a href="https://github.com/krams915/spring-batch-tutorial" rel="nofollow">https://github.com/krams915/spring-batch-tutorial</a> and I was able to successfully deploy the application, but when I click via application I see following error comes. ## Heading ##I've uploaded my code at: <strong><a href="https://github.com/test512/spring-batch-krams-tutorial/tree/master/spring-batch-krams-tutorial" rel="nofollow">https://github.com/test512/spring-batch-krams-tutorial/tree/master/spring-batch-krams-tutorial</a></strong></p>
  
  <pre><code>com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'spring_batch_tutorial.batch_job_execution_params' doesn't exist
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
      at com.mysql.jdbc.Util.getInstance(Util.java:387)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:942)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)
      at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
      at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1962)
      at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:1392)
      at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:692)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:684)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:716)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:741)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:751)
      at org.springframework.batch.core.repository.dao.JdbcJobExecutionDao.getJobParameters(JdbcJobExecutionDao.java:385)
      at org.springframework.batch.core.repository.dao.JdbcJobExecutionDao$JobExecutionRowMapper.mapRow(JdbcJobExecutionDao.java:415)
      at org.springframework.batch.core.repository.dao.JdbcJobExecutionDao$JobExecutionRowMapper.mapRow(JdbcJobExecutionDao.java:396)
      at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:93)
      at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:60)
      at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:697)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:684)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:716)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:726)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:781)
      at org.springframework.batch.core.repository.dao.JdbcJobExecutionDao.findJobExecutions(JdbcJobExecutionDao.java:131)
      at org.springframework.batch.core.repository.support.SimpleJobRepository.getStepExecutionCount(SimpleJobRepository.java:253)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
      at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
      at com.sun.proxy.$Proxy28.getStepExecutionCount(Unknown Source)
      at org.springframework.batch.core.job.flow.JobFlowExecutor.isStepRestart(JobFlowExecutor.java:82)
      at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:63)
      at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:67)
      at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:169)
      at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:144)
      at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:134)
      at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:306)
      at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:135)
      at java.lang.Thread.run(Unknown Source)
  2016-08-23 22:42:34.130 [SimpleAsyncTaskExecutor-1] DEBUG SqlUtils - Attempted to convert SQLException to SQLException. Leaving it alone. [SQLState: 42S02; errorCode: 1146]
  </code></pre>
  
  <p><strong>schema-mysql.sql</strong></p>
  
  <pre><code>-- Autogenerated: do not edit this file
  
  CREATE TABLE BATCH_JOB_INSTANCE  (
      JOB_INSTANCE_ID BIGINT  NOT NULL PRIMARY KEY ,  
      VERSION BIGINT ,  
      JOB_NAME VARCHAR(100) NOT NULL, 
      JOB_KEY VARCHAR(32) NOT NULL,
      constraint JOB_INST_UN unique (JOB_NAME, JOB_KEY)
  ) ENGINE=InnoDB;
  
  CREATE TABLE BATCH_JOB_EXECUTION  (
      JOB_EXECUTION_ID BIGINT  NOT NULL PRIMARY KEY ,
      VERSION BIGINT  ,  
      JOB_INSTANCE_ID BIGINT NOT NULL,
      CREATE_TIME DATETIME NOT NULL,
      START_TIME DATETIME DEFAULT NULL , 
      END_TIME DATETIME DEFAULT NULL ,
      STATUS VARCHAR(10) ,
      EXIT_CODE VARCHAR(100) ,
      EXIT_MESSAGE VARCHAR(2500) ,
      LAST_UPDATED DATETIME,
      constraint JOB_INST_EXEC_FK foreign key (JOB_INSTANCE_ID)
      references BATCH_JOB_INSTANCE(JOB_INSTANCE_ID)
  ) ENGINE=InnoDB;
  
  CREATE TABLE BATCH_JOB_PARAMS  (
      JOB_INSTANCE_ID BIGINT NOT NULL ,
      TYPE_CD VARCHAR(6) NOT NULL ,
      KEY_NAME VARCHAR(100) NOT NULL , 
      STRING_VAL VARCHAR(250) , 
      DATE_VAL DATETIME DEFAULT NULL ,
      LONG_VAL BIGINT ,
      DOUBLE_VAL DOUBLE PRECISION ,
      constraint JOB_INST_PARAMS_FK foreign key (JOB_INSTANCE_ID)
      references BATCH_JOB_INSTANCE(JOB_INSTANCE_ID)
  ) ENGINE=InnoDB;
  
  CREATE TABLE BATCH_STEP_EXECUTION  (
      STEP_EXECUTION_ID BIGINT  NOT NULL PRIMARY KEY ,
      VERSION BIGINT NOT NULL,  
      STEP_NAME VARCHAR(100) NOT NULL,
      JOB_EXECUTION_ID BIGINT NOT NULL,
      START_TIME DATETIME NOT NULL , 
      END_TIME DATETIME DEFAULT NULL ,  
      STATUS VARCHAR(10) ,
      COMMIT_COUNT BIGINT , 
      READ_COUNT BIGINT ,
      FILTER_COUNT BIGINT ,
      WRITE_COUNT BIGINT ,
      READ_SKIP_COUNT BIGINT ,
      WRITE_SKIP_COUNT BIGINT ,
      PROCESS_SKIP_COUNT BIGINT ,
      ROLLBACK_COUNT BIGINT , 
      EXIT_CODE VARCHAR(100) ,
      EXIT_MESSAGE VARCHAR(2500) ,
      LAST_UPDATED DATETIME, 
      JOB_CONFIGURATION_LOCATION VARCHAR(100),
      constraint JOB_EXEC_STEP_FK foreign key (JOB_EXECUTION_ID)
      references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
  ) ENGINE=InnoDB;
  
  CREATE TABLE BATCH_STEP_EXECUTION_CONTEXT  (
      STEP_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY,
      SHORT_CONTEXT VARCHAR(2500) NOT NULL,
      SERIALIZED_CONTEXT TEXT , 
      constraint STEP_EXEC_CTX_FK foreign key (STEP_EXECUTION_ID)
      references BATCH_STEP_EXECUTION(STEP_EXECUTION_ID)
  ) ENGINE=InnoDB;
  
  CREATE TABLE BATCH_JOB_EXECUTION_CONTEXT  (
      JOB_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY,
      SHORT_CONTEXT VARCHAR(2500) NOT NULL,
      SERIALIZED_CONTEXT TEXT , 
      constraint JOB_EXEC_CTX_FK foreign key (JOB_EXECUTION_ID)
      references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
  ) ENGINE=InnoDB;
  
  CREATE TABLE BATCH_STEP_EXECUTION_SEQ (ID BIGINT NOT NULL) ENGINE=MYISAM;
  INSERT INTO BATCH_STEP_EXECUTION_SEQ values(0);
  CREATE TABLE BATCH_JOB_EXECUTION_SEQ (ID BIGINT NOT NULL) ENGINE=MYISAM;
  INSERT INTO BATCH_JOB_EXECUTION_SEQ values(0);
  CREATE TABLE BATCH_JOB_SEQ (ID BIGINT NOT NULL) ENGINE=MYISAM;
  INSERT INTO BATCH_JOB_SEQ values(0);
  
  
  ALTER TABLE `BATCH_JOB_EXECUTION` MODIFY COLUMN `EXIT_CODE` varchar(2500) DEFAULT NULL;
  ALTER TABLE `BATCH_JOB_EXECUTION` ADD COLUMN `JOB_CONFIGURATION_LOCATION` varchar(2500) DEFAULT NULL;
  ALTER TABLE `BATCH_JOB_EXECUTION_SEQ` ADD COLUMN `UNIQUE_KEY` char(1) NOT NULL;
  ALTER TABLE `BATCH_JOB_EXECUTION_SEQ` ADD UNIQUE KEY `UNIQUE_KEY_UN` (`UNIQUE_KEY`);
  ALTER TABLE `BATCH_JOB_SEQ` ADD COLUMN `UNIQUE_KEY` char(1) NOT NULL;
  ALTER TABLE `BATCH_JOB_SEQ` ADD UNIQUE KEY `UNIQUE_KEY_UN` (`UNIQUE_KEY`);
  ALTER TABLE `BATCH_STEP_EXECUTION` MODIFY COLUMN `EXIT_CODE` varchar(2500) DEFAULT NULL;
  ALTER TABLE `BATCH_STEP_EXECUTION_SEQ` ADD COLUMN `UNIQUE_KEY` char(1) NOT NULL;
  ALTER TABLE `BATCH_STEP_EXECUTION_SEQ` ADD UNIQUE KEY `UNIQUE_KEY_UN` (`UNIQUE_KEY`);
  </code></pre>
  
  <p><strong>pom.xml</strong></p>
  
  <pre><code>&lt;properties&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
          &lt;springframework.version&gt;4.3.0.RELEASE&lt;/springframework.version&gt;
          &lt;springbatch.version&gt;3.0.6.RELEASE&lt;/springbatch.version&gt;
          &lt;hibernate.version&gt;4.3.6.Final&lt;/hibernate.version&gt;
          &lt;aspectj.version&gt;1.8.9&lt;/aspectj.version&gt;
          &lt;cglib.version&gt;3.2.4&lt;/cglib.version&gt;
          &lt;jackson.version&gt;1.9.13&lt;/jackson.version&gt;
          &lt;spring.data.jpa.version&gt;1.10.2.RELEASE&lt;/spring.data.jpa.version&gt;
          &lt;hibernate.entitymanager.version&gt;5.1.0.Final&lt;/hibernate.entitymanager.version&gt;
          &lt;javassist.version&gt;3.18.1-GA&lt;/javassist.version&gt;
          &lt;mysql.version&gt;5.1.39&lt;/mysql.version&gt;
          &lt;joda-time.version&gt;2.3&lt;/joda-time.version&gt;
          &lt;c3p0.version&gt;0.9.5-pre8&lt;/c3p0.version&gt;
          &lt;querydsl.version&gt;3.7.4&lt;/querydsl.version&gt;
          &lt;javax.servlet.version&gt;3.1.0&lt;/javax.servlet.version&gt;
          &lt;mockito.version&gt;1.10.19&lt;/mockito.version&gt;
          &lt;logback.version&gt;1.1.7&lt;/logback.version&gt;
          &lt;jcl-over-slf4j.version&gt;1.7.21&lt;/jcl-over-slf4j.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;!-- Spring Web and Web MVC --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
              &lt;version&gt;${springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
              &lt;version&gt;${springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Spring TX --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;
              &lt;version&gt;${springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Spring OXM --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-oxm&lt;/artifactId&gt;
              &lt;version&gt;${springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Spring Aspect --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-aspects&lt;/artifactId&gt;
              &lt;version&gt;${springframework.version}&lt;/version&gt;
              &lt;type&gt;jar&lt;/type&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Spring JDBC --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-jdbc&lt;/artifactId&gt;
              &lt;version&gt;${springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Spring Data JPA --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
              &lt;artifactId&gt;spring-data-jpa&lt;/artifactId&gt;
              &lt;version&gt;${spring.data.jpa.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Hibernate and JPA --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate.java-persistence&lt;/groupId&gt;
              &lt;artifactId&gt;jpa-api&lt;/artifactId&gt;
              &lt;version&gt;2.0-cr-1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
              &lt;version&gt;${hibernate.entitymanager.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Spring Batch --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.batch&lt;/groupId&gt;
              &lt;artifactId&gt;spring-batch-core&lt;/artifactId&gt;
              &lt;version&gt;${springbatch.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- QueryDSL --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.mysema.querydsl&lt;/groupId&gt;
              &lt;artifactId&gt;querydsl-core&lt;/artifactId&gt;
              &lt;version&gt;${querydsl.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.mysema.querydsl&lt;/groupId&gt;
              &lt;artifactId&gt;querydsl-jpa&lt;/artifactId&gt;
              &lt;version&gt;${querydsl.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.mysema.querydsl&lt;/groupId&gt;
              &lt;artifactId&gt;querydsl-apt&lt;/artifactId&gt;
              &lt;version&gt;${querydsl.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- MySQL --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;version&gt;${mysql.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- ComboPooledDataSource --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.mchange&lt;/groupId&gt;
              &lt;artifactId&gt;c3p0&lt;/artifactId&gt;
              &lt;version&gt;${c3p0.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- A seamless aspect-oriented extension to the Java programming language --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
              &lt;artifactId&gt;aspectjrt&lt;/artifactId&gt;
              &lt;version&gt;${aspectj.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.aspectj&lt;/groupId&gt;
              &lt;artifactId&gt;aspectjweaver&lt;/artifactId&gt;
              &lt;version&gt;${aspectj.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;cglib&lt;/groupId&gt;
              &lt;artifactId&gt;cglib-nodep&lt;/artifactId&gt;
              &lt;version&gt;${cglib.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-mapper-asl&lt;/artifactId&gt;
              &lt;version&gt;${jackson.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Jackson is a high-performance JSON processor (parser, generator) --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-core-asl&lt;/artifactId&gt;
              &lt;version&gt;${jackson.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
              &lt;version&gt;2.8.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- logging, slf4j --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;jcl-over-slf4j&lt;/artifactId&gt;
              &lt;version&gt;${jcl-over-slf4j.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
              &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
              &lt;version&gt;${logback.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Servlet, JSP API, JSTL, Standard --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
              &lt;version&gt;3.1.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet.jsp&lt;/groupId&gt;
              &lt;artifactId&gt;jsp-api&lt;/artifactId&gt;
              &lt;version&gt;2.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;jstl&lt;/artifactId&gt;
              &lt;version&gt;1.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;taglibs&lt;/groupId&gt;
              &lt;artifactId&gt;standard&lt;/artifactId&gt;
              &lt;version&gt;1.1.2&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Testing Framework mockito all, Junit, Spring Test --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.12&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.mockito&lt;/groupId&gt;
              &lt;artifactId&gt;mockito-all&lt;/artifactId&gt;
              &lt;version&gt;${mockito.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
              &lt;version&gt;${springframework.version}&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  </code></pre>
  
  <p>Other codes file using as it is. Please help.</p>
  
  <p><strong>applicationContext.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:p="http://www.springframework.org/schema/p" 
      xmlns:mvc="http://www.springframework.org/schema/mvc"
      xsi:schemaLocation="http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context.xsd
              http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"&gt;
  
      &lt;context:property-placeholder properties-ref="deployProperties" /&gt;
  
      &lt;!-- Activates various annotations to be detected in bean classes --&gt;
      &lt;context:annotation-config /&gt;
  
      &lt;!-- Scans the classpath for annotated components that will be auto-registered as Spring beans.
       For example @Controller and @Service. Make sure to set the correct base-package --&gt;
      &lt;context:component-scan base-package="org.krams" /&gt;
  
      &lt;!-- Configures the annotation-driven Spring MVC Controller programming model.
      Note that, with Spring 3.0, this tag works in Servlet MVC only!  --&gt;
      &lt;mvc:annotation-driven /&gt; 
  
      &lt;mvc:resources mapping="/resources/**" location="/resources/" /&gt; 
  
      &lt;!-- Import extra configuration --&gt;
      &lt;import resource="trace-context.xml"/&gt;
      &lt;import resource="spring-data.xml"/&gt;
      &lt;import resource="spring-batch.xml"/&gt;
      &lt;import resource="spring-batch-job1.xml"/&gt;
      &lt;import resource="spring-batch-job2.xml"/&gt;
      &lt;import resource="spring-batch-job3.xml"/&gt;
  
      &lt;bean id="deployProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"
          p:location="/WEB-INF/spring.properties" /&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>spring-batch.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:p="http://www.springframework.org/schema/p" 
          xmlns:tx="http://www.springframework.org/schema/tx"
          xmlns:context="http://www.springframework.org/schema/context"
          xmlns:jdbc="http://www.springframework.org/schema/jdbc"
          xmlns:util="http://www.springframework.org/schema/util"
          xmlns:aop="http://www.springframework.org/schema/aop"
          xmlns:batch="http://www.springframework.org/schema/batch"
          xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/tx  http://www.springframework.org/schema/tx/spring-tx.xsd
              http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context.xsd
              http://www.springframework.org/schema/jdbc  http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
              http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
              http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
              http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd"&gt;
  
      &lt;context:property-placeholder properties-ref="deployProperties" /&gt;
  
      &lt;bean id="userWriter" class="org.krams.batch.UserItemWriter"/&gt;
      &lt;bean id="roleWriter" class="org.krams.batch.RoleItemWriter"/&gt;  
  
      &lt;bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher"
          p:jobRepository-ref="jobRepository" 
          p:taskExecutor-ref="taskExecutor"/&gt;
  
      &lt;!-- 4.3. Configuring a JobLauncher asynchronously --&gt;
      &lt;bean id="taskExecutor" class="org.springframework.core.task.SimpleAsyncTaskExecutor" /&gt;
  
      &lt;!-- http://forum.springsource.org/showthread.php?59779-Spring-Batch-1-1-2-Standard-JPA-does-not-support-custom-isolation-levels-use-a-sp --&gt;
      &lt;!-- &lt;job-repository id="jobRepository" xmlns="http://www.springframework.org/schema/batch"
          data-source="jpaDataSource" 
          isolation-level-for-create="SERIALIZABLE"
          transaction-manager="transactionManager"
          table-prefix="BATCH_"
          max-varchar-length="100" /&gt; --&gt;
  
      &lt;bean id="jobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean"&gt;
           &lt;property name="dataSource" ref="jpaDataSource" /&gt;
           &lt;property name="transactionManager" ref="transactionManager"/&gt;
           &lt;property name="databaseType" value="MYSQL" /&gt;
           &lt;property name="tablePrefix" value="BATCH_"/&gt;
           &lt;property name="isolationLevelForCreate" value="ISOLATION_DEFAULT"/&gt;
      &lt;/bean&gt;  
  
      &lt;!-- &lt;bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"
          p:dataSource-ref="jpaDataSource" /&gt; --&gt;
  
      &lt;bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" &gt;
          &lt;property name="dataSource" ref="jpaDataSource" /&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>spring-data.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:p="http://www.springframework.org/schema/p" 
          xmlns:tx="http://www.springframework.org/schema/tx"
          xmlns:context="http://www.springframework.org/schema/context"
          xmlns:jdbc="http://www.springframework.org/schema/jdbc"
          xmlns:jpa="http://www.springframework.org/schema/data/jpa"
          xmlns:util="http://www.springframework.org/schema/util"
          xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/tx  http://www.springframework.org/schema/tx/spring-tx.xsd
              http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
              http://www.springframework.org/schema/jdbc  http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
              http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
              http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"&gt;
  
      &lt;context:property-placeholder properties-ref="deployProperties" /&gt;
  
      &lt;tx:annotation-driven transaction-manager="transactionManager" /&gt;   
  
      &lt;!-- Activate Spring Data JPA repository support --&gt;
      &lt;jpa:repositories base-package="org.krams.repository" /&gt;
  
      &lt;!-- Declare a datasource that has pooling capabilities--&gt;   
      &lt;bean id="jpaDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close" &gt;
          &lt;property name="driverClass" value="${app.jdbc.driverClassName}" /&gt;
          &lt;property name="jdbcUrl" value="${app.jdbc.url}" /&gt;
          &lt;property name="user" value="${app.jdbc.username}" /&gt;
          &lt;property name="password" value="${app.jdbc.password}" /&gt;
          &lt;property name="acquireIncrement" value="5" /&gt;
          &lt;property name="idleConnectionTestPeriod" value="60" /&gt;
          &lt;property name="maxPoolSize" value="100" /&gt;
          &lt;property name="maxStatements" value="50" /&gt;
          &lt;property name="minPoolSize" value="10" /&gt;
      &lt;/bean&gt;
  
      &lt;!-- Declare a JPA entityManagerFactory --&gt; 
      &lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" &gt;
          &lt;property name="dataSource" ref="jpaDataSource" /&gt;
          &lt;property name="persistenceXmlLocation" value="classpath*:META-INF/persistence.xml" /&gt;
          &lt;property name="persistenceUnitName" value="hibernatePersistenceUnit" /&gt;
          &lt;property name="jpaVendorAdapter" ref="hibernateVendor" /&gt;
          &lt;!-- &lt;property name="jpaProperties"&gt;
              &lt;props&gt;
                  &lt;prop key="hibernate.hbm2ddl.auto"&gt;create&lt;/prop&gt;
                  &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt; --&gt;
          &lt;property name="jpaDialect" ref="jpaDialect" /&gt;
      &lt;/bean&gt;
  
      &lt;!-- Specify our ORM vendor --&gt;
      &lt;bean id="hibernateVendor" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" &gt;
          &lt;property name="showSql" value="false" /&gt;
          &lt;!-- &lt;property name="database" value="MYSQL" /&gt; --&gt;
      &lt;/bean&gt;
  
       &lt;bean id="jpaDialect" class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" /&gt;
  
      &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
          &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt;
      &lt;/bean&gt; 
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong>spring-batch-job1.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:p="http://www.springframework.org/schema/p" 
          xmlns:tx="http://www.springframework.org/schema/tx"
          xmlns:context="http://www.springframework.org/schema/context"
          xmlns:jdbc="http://www.springframework.org/schema/jdbc"
          xmlns:util="http://www.springframework.org/schema/util"
          xmlns:aop="http://www.springframework.org/schema/aop"
          xmlns:batch="http://www.springframework.org/schema/batch"
          xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/tx  http://www.springframework.org/schema/tx/spring-tx.xsd
              http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
              http://www.springframework.org/schema/jdbc  http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
              http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
              http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
              http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd"&gt;
  
      &lt;context:property-placeholder properties-ref="deployProperties" /&gt;
  
      &lt;job id="batchJob1" xmlns="http://www.springframework.org/schema/batch"&gt;
          &lt;step id="userload1" next="roleLoad1"&gt;
              &lt;tasklet&gt;
                  &lt;chunk reader="userFileItemReader1" writer="userWriter" commit-interval="${job.commit.interval}" /&gt;
              &lt;/tasklet&gt;
          &lt;/step&gt;
          &lt;step id="roleLoad1"&gt;
              &lt;tasklet&gt;
                  &lt;chunk reader="roleFileItemReader1" writer="roleWriter" commit-interval="${job.commit.interval}" /&gt;
              &lt;/tasklet&gt;
          &lt;/step&gt;
      &lt;/job&gt;
  
      &lt;bean id="userFileItemReader1" class="org.springframework.batch.item.file.FlatFileItemReader"&gt;
          &lt;property name="resource" value="classpath:${user1.file.name}" /&gt;
          &lt;property name="lineMapper"&gt;
              &lt;bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper"&gt;
                  &lt;property name="lineTokenizer"&gt;
                      &lt;bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer"&gt;
                          &lt;property name="names" value="username,firstName,lastName,password" /&gt;
                      &lt;/bean&gt;
                  &lt;/property&gt;
                  &lt;property name="fieldSetMapper"&gt;
                      &lt;bean class="org.krams.batch.UserFieldSetMapper" /&gt;
                  &lt;/property&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="roleFileItemReader1" class="org.springframework.batch.item.file.FlatFileItemReader"&gt;
          &lt;property name="resource" value="classpath:${role1.file.name}" /&gt;
          &lt;property name="lineMapper"&gt;
              &lt;bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper"&gt;
                  &lt;property name="lineTokenizer"&gt;
                      &lt;bean class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer"&gt;
                          &lt;property name="names" value="username,role" /&gt;
                      &lt;/bean&gt;
                  &lt;/property&gt;
                  &lt;property name="fieldSetMapper"&gt;
                      &lt;bean class="org.krams.batch.RoleFieldSetMapper" /&gt;
                  &lt;/property&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
      &lt;/bean&gt; 
  &lt;/beans&gt;
  </code></pre>