Re: reportQuery and functions in query

Joose Vettenranta <[email protected]> Fri, 14 Dec 2007 11:57:27 +0200
Newsgroups gmane.comp.jakarta.ojb.user
Message-ID <[email protected]>
To make this question simpler, how to do reportquery where:

queryArguments[0] ="id";
queryArguments[1] ="sum(foo.bar * foo.quux *)";

Thanks,

Joose


Joose Vettenranta kirjoitti 23.11.2007 kello 14.59:

> Hi,
>
> I have query that has like SELECT sum(foo) FROM bar; and that works  
> ok. Problem comes with following syntax:
> SELECT sum(foo * quux) FROM bar;
>
> Code goes something like this:
>
> query=new  
> org 
> .apache.ojb.broker.query.ReportQueryByCriteria(ibizobj.getClass(),  
> criteria);
> queryArguments[0]="id";
> queryArguments[7]="sum(orderItems.unitPrice * orderItems.amount)";
> query.setAttributes(queryArguments);
> groupArguments[0]="id";
> query.addGroupBy(groupArguments);
> query.setPathOuterJoin("orderItems");
>
> and outcome: SELECT looks like this on server:  
> SELECT ...sum(orderItems.unitPrice * orderItems.amount)...
> and respone: "adding missing FROM" and "orderItems not found"..
>
> it should do something like SELECT ....sum(A2.unitPrice * A2.amount)..
>
> Is this feature that is not implemented in 1.0.4 or am I missing  
> something?
>
> Thanks,
>
> Joose
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>