Announcement Announcement Module
Collapse
No announcement yet.
csv file processing with spring batch to insert into DB Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • csv file processing with spring batch to insert into DB

    Hi,

    My requirement is like ..

    taking the csv file data and insert into Data base.using hibernate and spring batch

    but my csv file data is not consistent.that means some columns may be empty.for example ..if there are total 11 columns are there ,while processing the row in file some times i will pass only 8 columns.. some times 10..like that ..how to deal with this type of requirement.

    the exception I am getting is

    org.springframework.batch.item.file.FlatFileParseE xception: Parsing error at line: 1, input=[DICTIONARY,22104,ANTIQUE PAPER,LOGICAL DUPLICATE,Duplicate,EN_ZZ,,,] at org.springframework.batch.item.file.mapping.Defaul tLineMapper.mapLine(DefaultLineMapper.java:49) at org.springframework.batch.item.file.FlatFileItemRe ader.doRead(FlatFileItemReader.java:188) at org.springframework.batch.item.support.AbstractIte mCountingItemStreamItemReader.read(AbstractItemCou ntingItemStreamItemReader.java:87) at org.springframework.batch.core.step.item.SimpleChu nkProvider.doRead(SimpleChunkProvider.java:90) at org.springframework.batch.core.step.item.SimpleChu nkProvider.read(SimpleChunkProvider.java:127) at org.springframework.batch.core.step.item.SimpleChu nkProvider$1.doInIteration(SimpleChunkProvider.jav a:106) at org.springframework.batch.repeat.support.RepeatTem plate.getNextResult(RepeatTemplate.java:367) at org.springframework.batch.repeat.support.RepeatTem plate.executeInternal(RepeatTemplate.java:214) at org.springframework.batch.repeat.support.RepeatTem plate.iterate(RepeatTemplate.java:143) at org.springframework.batch.core.step.item.SimpleChu nkProvider.provide(SimpleChunkProvider.java:103) at org.springframework.batch.core.step.item.ChunkOrie ntedTasklet.execute(ChunkOrientedTasklet.java:68) at org.springframework.batch.core.step.tasklet.Taskle tStep$ChunkTransactionCallback.doInTransaction(Tas kletStep.java:347) at org.springframework.transaction.support.Transactio nTemplate.execute(TransactionTemplate.java:128) at org.springframework.batch.core.step.tasklet.Taskle tStep$2.doInChunkContext(TaskletStep.java:261) at org.springframework.batch.core.scope.context.StepC ontextRepeatCallback.doInIteration(StepContextRepe atCallback.java:76) at org.springframework.batch.repeat.support.RepeatTem plate.getNextResult(RepeatTemplate.java:367) at org.springframework.batch.repeat.support.RepeatTem plate.executeInternal(RepeatTemplate.java:214) at org.springframework.batch.repeat.support.RepeatTem plate.iterate(RepeatTemplate.java:143) at org.springframework.batch.core.step.tasklet.Taskle tStep.doExecute(TaskletStep.java:247) at org.springframework.batch.core.step.AbstractStep.e xecute(AbstractStep.java:196) at org.springframework.batch.core.job.SimpleStepHandl er.handleStep(SimpleStepHandler.java:115) at org.springframework.batch.core.job.flow.JobFlowExe cutor.executeStep(JobFlowExecutor.java:61) at org.springframework.batch.core.job.flow.support.st ate.StepState.handle(Step

  • #2
    The tokenizer and.or the field set mapper probably has a "strict" property that you can set?

    Comment

    Working...
    X