You have to use a ReportQueryByCriteria() where you can specify which attributes you want OJB to return instead of a getCollection(). Following your example:
Criteria crit = new Criteria();
// Set criterias ... crit.addEqualTo(...);
// Create the report query. ReportQueryByCriteria q = QueryFactory.newReportQuery(A.class, crit);
// You can also ask for aggregate functions (SUM(A.xxx)) ... q.setAttributes(new String[] {"A.xxx", "A.yyy", "B.zzz" });
// And you can set 'orderBy' and 'groupBy' clauses ... q.addGroupBy("A.xxx"); ... q.addOrderBy("B.zzz"); ...
return broker.getReportQueryIteratorByQuery(q); // which returns an Object[]
Hope it helps you, Enrique Medina.
From: Info <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: OJB - Query for two table join Date: Thu, 22 Apr 2004 01:21:37 -0400
Hi,
For example, I have two table A and B. Now I want a combination collection of some field of A and some of B:
SELECT A.xxx, A.yyy, B.zzz FROM A INNER JOIN B ON A.id = B.id
I will get a colleciton as a result after open a query by using OJB, but how can I get the data (xxx, yyy, zzz) from a Collection?
If OJB does not support this feature, any alternetive solutions available right now?
Thanks,
Wallace
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
¿Dónde se esconden [EMAIL PROTECTED] [EMAIL PROTECTED] Encuentra miles de perfiles en MSN Amor & Amistad. http://match.msn.es/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]