Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JobExplorer.findJobInstancesByJobName(java.lang.String jobName, int start, int count) does not return job instances in descending order of job instance id [BATCH-2835] #781

Closed
spring-issuemaster opened this issue Jul 25, 2019 · 2 comments

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Jul 25, 2019

hli-git3 opened BATCH-2835 and commented

JobExplorer.findJobInstancesByJobName(java.lang.String jobName, int start, int count) does not return a list of job instances in the descending order of created time(or job instance id). 

Though the query used in org.springframework.batch.core.repository.dao.JdbcJobInstanceDao 

is:

SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME like ? order by JOB_INSTANCE_ID desc

,

when I inspected the data in the list of job instances returned from the .findJobInstancesByJobName , they are not ordered by job_instance_id.

 

 


Affects: 4.1.2

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Aug 6, 2019

mohamed chebbi commented

the call to JobExplorer.findJobInstancesByJobName(java.lang.String jobName, int start, int count) work fine for me.

// code placeholder
List<org.springframework.batch.core.JobInstance> jid = je.findJobInstancesByJobName("mpo", 1, 30); 
for (JobInstance jobInstance : jid) { System.out.println(jobInstance.getInstanceId() + " " + jobInstance.getJobName()); }

 

i got this output:

135 importUserJob
134 importUserJob
133 importUserJob
132 importUserJob
131 importUserJob
130 importUserJob
129 importUserJob
128 importUserJob
127 importUserJob
126 importUserJob
125 importUserJob
124 importUserJob
123 importUserJob
122 importUserJob
121 importUserJob
120 importUserJob
119 importUserJob
118 importUserJob
117 importUserJob
116 importUserJob
115 importUserJob
114 importUserJob
113 importUserJob
112 importUserJob
111 importUserJob
110 importUserJob
109 importUserJob
108 importUserJob
107 importUserJob
106 importUserJob

can yougive  steps to reproduce this bug, and what is the version of H2 yiou use.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Aug 6, 2019

hli-git3 commented

Thanks for taking a look. It turns out the H2 version I was using caused this issue. I was using com.h2database:h2:1.4.187, and when it is upgraded to 1.4.199, it works as expected.

Thanks again, and please go ahead to close this bug and mark this bug as invalid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.