title: Spring Batch Writer throws java.sql.SQLException: Unsupported feature
body: <p>I am facing challenge in retrieving auto generated column of Oracle table in my Spring Batch POC.</p>
  
  <p>This POC reads data from flat file and loads into oracle table. I am trying to use Oracle Sequence to generate primary key for the table and retrieve that upon successful insertion of row from Spring Batch Writer implementation. But It throws folllowing error.</p>
  
  <pre><code>org.springframework.jdbc.UncategorizedSQLException: 
  PreparedStatementCallback; uncategorized SQLException for SQL
  </code></pre>
  
  <p>I am not sure I am missing anything or any issue related to oracle driver. Need your valuable inputs.</p>
  
  <p>Specifications:</p>
  
  <pre><code>Oracle Database version  11.1.0.7
  Oracle Driver that is added to Maven Proj  ojdbc14-10.1.0.5.jar
  JDK Version 1.8
  spring.version 4.0.5.RELEASE
  spring.jdbc.version 4.0.5
  spring.batch.version 3.0.4.RELEASE
  </code></pre>
  
  <p>My job.xml</p>
  
  <pre><code>&lt;bean class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate" id="namedParameterJdbcTemplate"&gt;
  &lt;constructor-arg ref="dataSource"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>My CustomerItemWriter class:</p>
  
  <pre><code>    public class CustomItemWriter implements ItemWriter&lt;Permission&gt;
  {
  
  private final static String INSERT_SQL = "insert into CUSTOMERS (CUST_ID,FIRSTNAME,LASTNAME,CREATED_DATE) VALUES (CUST_ID_SEQ.NEXTVAL,:firstname,:lastname,:CreatedDate)";
  
      @Autowired
      private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
  
      @Override
      public void write(List&lt;? extends Customer&gt; customers) throws Exception
      {
          for( Customer customer : customers )
          {
              MapSqlParameterSource namedParameters = new MapSqlParameterSource();
              namedParameters.addValue("firstname", customer.getLdapUserId());
              namedParameters.addValue("lastname", customer.getRoleId());            
              namedParameters.addValue("CreatedDate", customer.getCreatedDate());
  
              final KeyHolder holder = new GeneratedKeyHolder();
              this.namedParameterJdbcTemplate.update( INSERT_SQL, namedParameters, holder, new String[] {"CUST_ID" } );
              Number generatedId = holder.getKey();
              System.out.println("Oracle Seq value " + generatedId.intValue());
          }
      }
  </code></pre>
  
  <p>Exception received while executing:</p>
  
  <pre><code>    Aug 24, 2016 12:02:56 AM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
  INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@728938a9: startup date [Wed Aug 24 00:02:56 EDT 2016]; root of context hierarchy
  Aug 24, 2016 12:02:56 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  INFO: Loading XML bean definitions from class path resource [META-INF/spring/job-config.xml]
  Aug 24, 2016 12:02:56 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  INFO: Loading XML bean definitions from class path resource [META-INF/spring/context-config.xml]
  Aug 24, 2016 12:02:56 AM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition
  INFO: Overriding bean definition for bean 'customReader': replacing [Generic bean: class [org.springframework.batch.item.file.FlatFileItemReader]; scope=step; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=false; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [META-INF/spring/context-config.xml]] with [Root bean: class [org.springframework.aop.scope.ScopedProxyFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in BeanDefinition defined in class path resource [META-INF/spring/context-config.xml]]
  Aug 24, 2016 12:02:56 AM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
  INFO: Loaded JDBC driver: oracle.jdbc.xa.client.OracleXADataSource
  Aug 24, 2016 12:02:57 AM org.springframework.batch.core.launch.support.SimpleJobLauncher afterPropertiesSet
  INFO: No TaskExecutor has been set, defaulting to synchronous executor.
  Aug 24, 2016 12:02:57 AM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
  INFO: Loaded JDBC driver: oracle.jdbc.xa.client.OracleXADataSource
  Aug 24, 2016 12:03:00 AM org.springframework.batch.core.launch.support.SimpleJobLauncher run
  INFO: Job: [FlowJob: [name=GCMPBatchFeedJob]] launched with the following parameters: [{date=1472011377348, inputFile=C:/Work/BatchPOC/springbatch/GCMPBatchFeed/target/GCMPFeedData1.csv}]
  Aug 24, 2016 12:03:06 AM org.springframework.batch.core.job.SimpleStepHandler handleStep
  INFO: Executing step: [importFileStep]
  Aug 24, 2016 12:03:09 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  INFO: Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
  Aug 24, 2016 12:03:09 AM org.springframework.jdbc.support.SQLErrorCodesFactory &lt;init&gt;
  INFO: SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
  Aug 24, 2016 12:03:09 AM org.springframework.batch.core.step.AbstractStep execute
  SEVERE: Encountered an error executing step importFileStep in job GCMPBatchFeedJob
  org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO CUSTOMERS (CUST_ID,FIRSTNAME,LASTNAME,CREATED_DATE) VALUES (CUST_ID_SEQ.NEXTVAL, ?, ?, ?)]; SQL state [null]; error code [17023]; Unsupported feature; nested exception is java.sql.SQLException: Unsupported feature
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:84)
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:660)
      at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:943)
      at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.update(NamedParameterJdbcTemplate.java:344)
      at com.comp.sbatch.writer.CustomItemWriter.write(CustomItemWriter.java:171)
      at org.springframework.batch.core.step.item.SimpleChunkProcessor.writeItems(SimpleChunkProcessor.java:175)
      at org.springframework.batch.core.step.item.SimpleChunkProcessor.doWrite(SimpleChunkProcessor.java:151)
      at org.springframework.batch.core.step.item.SimpleChunkProcessor.write(SimpleChunkProcessor.java:274)
      at org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:199)
      at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:75)
      at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406)
      at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330)
      at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
      at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271)
      at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:77)
      at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:368)
      at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)
      at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144)
      at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:257)
      at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:198)
      at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:148)
      at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:64)
      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:165)
      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:304)
      at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:135)
      at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
      at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:128)
      at com.comp.sbatch.App.main(App.java:35)
  Caused by: java.sql.SQLException: Unsupported feature
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
      at oracle.jdbc.driver.DatabaseError.throwUnsupportedFeatureSqlException(DatabaseError.java:537)
      at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:3094)
      at org.springframework.jdbc.core.PreparedStatementCreatorFactory$PreparedStatementCreatorImpl.createPreparedStatement(PreparedStatementCreatorFactory.java:233)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:638)
      ... 29 more
  </code></pre>