Skip to Content
0
Nov 17, 2011 at 02:22 PM

jcsSession.executeObjectQuery

95 Views

Hello All,

I try to create a jcsSession.executeObjectQuery and need a hint.

The statment should query Job with a special JobDefinition. My problem ist the where-Clause.

I want to do something like this:

select * from Job where Job.JobDefinition = <JobDefinition>

If a create a statement like this:

String query = "select * from Job where Description like %something%
for(Iterator itQuery = jcsSession.executeObjectQuery(query, null ); itQuery.hasNext();)
		{
			Job j = (Job) itQuery.next();
			//jcsOut.println(j.getJobId().toString());
		}

it works. Because the Description-Field has type String. The field JobDefinition has type obj.JobDefinition. So how I do create a query on this field?

I'am sure it must be similar like that code:

Job job = jcsSession.getJobByJobId(jobID);
JobDefinition definition = job.getDefinition();

String query = "select * from Job where JobDefinition = ?";

for(Iterator itQuery = jcsSession.executeObjectQuery(query, new Object [] {definition); itQuery.hasNext();)
{
   Job j = (Job) itQuery.next();
   .... 
}

Kind regards

Marc