logo       

Re: [enhydra] Problem with aggregate function made via DODS: msg#00006

java.enhydra.general

Subject: Re: [enhydra] Problem with aggregate function made via DODS

Sinisa Milosevic wrote:

Hi,

In DODS templates (xxxQuery class-writeFileHeaderQuery), you will find
selectCount method. You can use similar scenario and extend your templates
and generate selectSum method for your purposes.

I hope it helps.

Regards,
Sinisa




----- Original Message ----- From: "Daniel" <daniel.guryca@xxxxxxxxxx>
To: <enhydra@xxxxxxxxxxxxx>
Sent: Friday, April 22, 2005 12:44 PM
Subject: [enhydra] Problem with aggregate function made via DODS



I have problem with aggregate function made via DODS.
In DODS mailing list/forum has nobody helped me.

If I print final SQL - via query.debug() -
I get - SELECT sum(amount) FROM Person - which is OK.
But dbQuery.next always returns null. Why?
How could I implement these aggregate functions if this is not the

right way.

My code: DBQuery dbQuery = null;
QueryBuilder query = null;
Object obj = null;

PersonQuery origQuery = new PersonQuery();
query = origQuery.getQueryBuilder();
query.setSelectClause(" sum(amount) as \"suma\" ");

dbQuery = PersonDO.createQuery();
query.debug();

dbQuery.query(query);
obj = dbQuery.next();

I use Enhydra 5.1.15.

Thank you for your help.






----------------------------------------------------------------------------
----



--
You receive this message as a subscriber of the enhydra@xxxxxxxxxxxxx

mailing list.

To unsubscribe: mailto:enhydra-unsubscribe@xxxxxxxxxxxxx
For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws





------------------------------------------------------------------------


--
You receive this message as a subscriber of the enhydra@xxxxxxxxxxxxx mailing
list.
To unsubscribe: mailto:enhydra-unsubscribe@xxxxxxxxxxxxx
For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

Yes, I have done it accordinglly. Thank you. It really works.
But what happens if I upgrade enhydra or dods to a higher version. I will lose all of my stuff.

So is there a way how to separate my code from DODS standard code. (I mean if my methods could be in a separated file so they would be imported to main writeFileHeaderQuery.xls only). Or something like that ?
Thank you for your patiance.


--
You receive this message as a subscriber of the enhydra@xxxxxxxxxxxxx mailing
list.
To unsubscribe: mailto:enhydra-unsubscribe@xxxxxxxxxxxxx
For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise