You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Michael Scholz <mi...@infogeneration.de> on 2003/08/22 15:12:44 UTC

ReportQueryByCriteria

Hello,

can anyone send me an example for using ReportQueryByCriteria.


thanks

Micha

Re: ReportQueryByCriteria

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Micha,

see
http://db.apache.org/ojb/query.html#report queries

seems this section is corrupted (description lacks)
so generate OJB offline docs
bin\build.bat doc

generated docs can be found
.../target/doc/index.html
see same section.

regards,
Armin

----- Original Message ----- 
From: "Michael Scholz" <mi...@infogeneration.de>
To: <oj...@db.apache.org>
Sent: Friday, August 22, 2003 3:12 PM
Subject: ReportQueryByCriteria


Hello,

can anyone send me an example for using ReportQueryByCriteria.


thanks

Micha



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: ReportQueryByCriteria

Posted by Thomas Cornet <th...@cornet.name>.
Let's take an example :

class HouseOwners
{
         private long ownerID;
         private long houseID;
}

Code to get the number of houses a owner has (where houseID >= 1000, and 
list only owners who have at least one house)

Criteria c = new Criteria();
c.addGreaterOrEqualThan("houseID", "1000");

ReportQueryByCriteria q = new ReportQueryByCriteria(HouseOwners.class, c);
q.setColumns(new String[] {"ownerID", "sum(houseID)"});
q.addGroupBy("ownerID");
q.addOrderByDescending("sum(houseID)");

Criteria having = new Criteria();
havind.addGreaterThan("sum(houseID)", "0");

q.setHavingCriteria(having);

Then you just have to get your PB to execute the query :

Iterator iter = mybroker.getReportQueryIteratorByQuery(q);


Thomas

At 15:12 22/08/2003, you wrote:
>Hello,
>
>can anyone send me an example for using ReportQueryByCriteria.
>
>
>thanks
>
>Micha



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org