I have this exact same issue.
How do you speify the join with the ReportQueryByCriteria.

thanks in advance
Mohnish

-----Original Message-----
From: Info [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 22, 2004 1:00 PM
To: OJB Users List
Subject: Re: OJB - Query for two table join


Enrique Medina wrote:

> Hi Wallace,
>
> 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]
>
>
>
>
Wonderful! You reply help me a lot!

Thanks!
Wallace

---------------------------------------------------------------------
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