javajsr352jberetjbatch

Jberet, manually set writecount on batchlet


I wonder if is possible to manually set writecount property on a batchlet in order to log result on STEP_EXECUTION.WRITECOUNT field's table.

This is my pseudo code

@Inject
EntityManager entityManager;

@Inject
private Logger logger;


@Transactional(Transactional.TxType.REQUIRED)
public void executeQuery(String query) {

    final int output = entityManager.createNativeQuery(query).executeUpdate();

    logger.info("rows updated: {}", output);
}

Solution

  • STEP_EXECUTION.WRITECOUNT column in the table is not applicable to a batchlet step. If you set data to it, it will still be meaningless. But I think if you somehow set this value in your batchlet, it will be persisted to the job repository.