I use Spring Batch for cloning table from source to target database. The job is started manually from service layer using jobLauncher with passing parameters.
Using .chunk(new DefaultResultCompletionPolicy()) in step description is suitable for my case. This policy returns true from isComplete(RepeatContext context, RepeatStatus result) in case of null-result - than ResultSet is over.