0

I have a two step in my Job Step 1-->Truncate data from table A Step 2--> Read from different datasource and insert data into table A

In Step 1 initialization of writer bean is throwing the exception, below is the code of writer bean and exception.

        @Bean
    public ItemWriter truncateData() {
        JdbcBatchItemWriter writer = new JdbcBatchItemWriter();
        writer.setSql("TRUNCATE TABLE A"); 
        writer.setDataSource(dwhDataSource);
        return writer;
    }

Exception:-

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'truncateData' defined in class path resource Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Using SQL statement with '?' placeholders requires an ItemPreparedStatementSetter

Please let me know if you need more information and i'm doing any wrong in creating the bean.

prakash
  • 111
  • 3
  • 9

0 Answers0