java - Query batch job metadata in Spring batch -
i want fetch 10 latest records batch_job_execution-table joined batch_job_instance-table.
so how can access these tables?
in application have used spring data jpa. it's application uses spring batch , created these tables. in other words, run join-query , map directly custom object necessary fields. far it's possible, avoid making seperate models 2 tables. don't know best approach here.
if want spring batch code need use jobexplorer , apply filters on either start_time or end_time. alternatively, send sql query desired join db using jdbc. ddls of metadata tables can found here.
edit
if want try in springbatch, guess need iterate through jobexecutions , find ones interest you, thing )) someth. like:
list<jobinstance> jobinstances = jobexplorer.getjobinstances(jobname); (jobinstance jobinstance : jobinstances) { list<jobexecution> jobexecutions = jobexplorer.getjobexecutions(jobinstance); (jobexecution jobexecution : jobexecutions) { if (//jobexecution.getwhatever...)) { // thing... } } } good luck!
Comments
Post a Comment