Jberet, manually set writecount on batchlet

130 Views Asked by At

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);
}
1

There are 1 best solutions below

1
On BEST ANSWER

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.