Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have steps in the batch job that does different things.

But before I begin all these steps, I need to clear a table. Is there any simple way to write a tasklet that will delete the table directly from the job xml file ?

I am using ibatis as ORM

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
585 views
Welcome To Ask or Share your Answers For Others

1 Answer

you mean even more simple than a tasklet, e.g. like this pseudocode ?

<!-- xml bean config -->
<bean id="deleteTableTaskletStep" class="...">
   <property name="dataSource" ref="dataSource" />
   <property name="sql" value="delete from ..." />
</bean>

// java code
public class DeleteTableTasklet implements Tasklet {

@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
    new JdbcTemplate(this.dataSource).executeQuery(this.sql)
    return RepeatStatus.FINISHED;
}
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...