This content has been marked as final. Show 7 replies
Using cohql, you cannot achieve join functionality across caches. This can be achieved using backing map api's.
Hope this helps!
Coherence does not support server-based joins. However, you can do a "psuedo" join on the client by using result sets from one query as input to another query.
Set setKeys = cache1.keySet(filter);
Set setEntries = cache2.entrySet(new InFilter("getForeignKey", setKeys));
Thanks for your quick response. I have also found the same solution from below link. Please let me know if it work's in CohQL command-line tool.
Thanks for your response. Please let me know, how to use map api's in CohQL command-line tool.
The solution Ben posted in his blog will not work with CohQL. I work on the same project as Ben and the solution we have uses custom aggregators to perform the joins whereas CohQL mainly maps the query statement to reflection extractors, reflection filters and some built in aggregators.
what is the equivalent query for this in CohQL
from Orders o, OrderDetails od
where o.orderId = od.orderId
and o.orderDate = today()
and od.unitPriceQuantityDiscount = 0.05
As NJ said - there is no join functionality in CohQL; the statement you posted above is a join between Orders and OrderDetail so it is not supported. There are other ways to implement the statement in code but not in CohQL. If OrderDetails are key associated to Orders you could use the techniques in Ben's blog you linked to above or something like the code here http://thegridman.com/coherence/coherence-backing-map-filter-queries-and-cache-join-queries/ but both of those techniques require code rather than simple CohQL.
Personally I wouldn't get too hung up on CohQL as in my opinion it currently uses reflection to much and I can build far more efficient queries in code using POF. Before anyone else says it, yes I realise I could make CohQL more efficient with indexes, but I may not want to index everything in my caches.