criteria pointing to the enclosing query have to be prefixed like criteria referencing a relationship.
the current prefix is defined in Criteria.PARENT_QUERY_PREFIX. as long as you use this static var everything will also work in future releases:
Criteria.PARENT_QUERY_PREFIX + "groupId"
hth jakob
Bonnie MacKellar wrote:
OK, I'm sorry, but what do you mean by "the prefix needs to be defined"? Is this something that will be available in the next release?
thanks, Bonnie MacKellar
-----Original Message----- From: Jakob Braeuchi [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 01, 2003 5:11 PM To: OJB Users List Subject: Re: not exists criteria - does it work?
hi bonnie,
this is possible but not yet documented because the prefix needs to be defined.
see QueryTest#testSubQuery4
public void testSubQuery4() {
ReportQueryByCriteria subQuery; Criteria subCrit = new Criteria(); Criteria crit = new Criteria();
subCrit.addEqualToField("productGroupId",Criteria.PARENT_QUERY
_PREFIX + "groupId");
subQuery = QueryFactory.newReportQuery(Article.class, subCrit);
subQuery.setColumns(new String[]{"count(productGroupId)"});
crit.addGreaterThan(subQuery,"10"); // MORE than 10 articles
crit.addLessThan("groupId",new Integer(987654));
Query q = QueryFactory.newQuery(ProductGroup.class, crit);
Collection results = broker.getCollectionByQuery(q); assertNotNull(results); assertTrue(results.size() == 4); }
hth jakob
Bonnie MacKellar wrote:
Is it true that you can't link the subquery in a not exists clauseof using a not
(Criteria.addNotExists)
to the results in the outer query? What would be the point
payment transactionsexists clause if you can't do that?
I have a table SuggestedPayments, which participates in a M to N relationship called CompletedBy, with a table called PaymentTxn.
I need to retrieve all SuggestedPayments that have no
with a paid status.clause, retrieving
The only way I can think to do this is with a not exists
the payment transactions for a suggested payment in the subquery. But then I need to link the subquery.
Is there another way?
thanks, Bonnie MacKellar
--------------------------------------------------------------------- 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]
