on 01-21-2015 1:19 PM
Hello,
my script should select jobs with a certain value of a given parameter and write the jobnames into a table.
But I cannot iterate through the selected jobs.
I get the error message "Cannot cast class com.redwood.scheduler.model.JobDefinitionParameterImpl to interface com.redwood.scheduler.api.model.JobDefinition" directly after control1. control2 will not be inserted in stdout.log.
Iterator jobDefinitions;
String sql = "select jdp.* from JobDefinition jd, JobDefinitionParameter jdp " +
"where jdp.DefaultExpression like ? " +
"and jdp.JobDefinition = jd.UniqueId " +
"and jd.MasterJobDefinition = jd.UniqueId " +
"and jdp.Name like ? ";
String sql1 = "select jdp.* from JobDefinition jd, JobDefinitionParameter jdp, Application ap " +
"where ap.Name = ? " +
"and jdp.JobDefinition = jd.UniqueId " +
"and jd.MasterJobDefinition = jd.UniqueId " +
"and jdp.DefaultExpression like ? " +
"and jdp.Name like ? ";
if(app != null){
jobDefinitions = jcsSession.executeObjectQuery(sql1, new Object[]{app.getName(),p_ParamValue,p_JobParameter});
}else{
jobDefinitions = jcsSession.executeObjectQuery(sql, new Object[]{p_ParamValue,p_JobParameter});
}
if (!jobDefinitions.hasNext())
{
return;
}
while (jobDefinitions.hasNext())
{
jcsOut.println("control 1" );
JobDefinition jd = (JobDefinition) jobDefinitions.next();
jcsOut.println("control 2" );
Why the jobdefinition cannot be seperated from the iterator?
Thanks and best regards
Dana
hi Dana,
You are doing a select on JobDefinitionParameter and casting it to JobDefinition object, which is causing the error.
Modify your query to
"select jd.*...."
thanks
Nanda
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.