hi dirk,


ReportQueryByCriteria subQuery; Criteria subCrit = new Criteria(); Criteria crit = new Criteria();

        subQuery = QueryFactory.newReportQuery(Schedule.class, subCrit);
        subQuery.setColumns(new String[] { "activityId" });

        crit.addNotIn("activityId", subQuery);
        Query q = QueryFactory.newQuery(Activity.class, crit);

results = broker.getCollectionByQuery(q);

for a working sample please have a look at QueryTest#testSubQuery2.

hth
jakob

Dirk Manske (Service Respond) wrote:
Hi,

I am using PB API and have two classes Activity and Schedule with 1:N
association. Both are declared in the repository-user.xml with a
collection-descriptor as reference.  Now I want to process a query which
results in a collection with all activities where no schedule has been set.
I have read the Query examples carefully but I just don't get it. Could
someone help me with the following sql statement:

SELECT * FROM Activity As act

WHERE act.ACTIVITY_ID NOT IN

(SELECT ACTIVITY_ID FROM SCHEDULE);


Looks so simple, but I cannot figure it out. How to set up this statement using the Criteria class?

Hope someone can help. thanks,

Dirk


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to