on 09-29-2022 10:57 AM
Hello Experts,
Kindly check the below code for setting the application of the job which is running fine however when persisted the changes are not applied. Kindly check and let me know if any modification is required in the code.
{
for (Iterator it = jcsSession.executeObjectQuery("select JobDefinition.* from JobDefinition where JobDefinition.MasterJobDefinition = JobDefinition.UniqueId and JobDefinition.Name like 'CUS_IBP%'", null); it.hasNext(); ) {
JobDefinition jobdef = (JobDefinition) it.next();
if (jobdef.getName() != null) {
try{
Partition p = jcsSession.getPartitionByName("GLOBAL");
Application app = jcsSession.getApplicationByName(p,null,"IBP_JOBS");
jobdef.setParentApplication(app);
jcsSession.persist();
jcsOut.println(jobdef.getName() + ": Application set");
}
catch (Exception e){
jcsErr.println(jobdef.getName() + ": Application could not be set");
}
}
}
}
Thanks in advance!!
hello,
two items:
1) did the application lookup actually find something?
2) you could do the application lookup (before) and the persist (after) outside of the loop
Regards Gerben
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.