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 Jakob Braeuchi <jb...@gmx.ch> on 2006/02/10 22:39:49 UTC
Re: howto query this
hi hans,
please try the following count-query:
Criteria crit = new Criteria();
crit.addEqualTo("phoneNumber.rftelco.rftelcoId", new Integer(65));
broker.getCount(query);
the generated sql for hsqldb looks like this:
SELECT count(*) FROM CALLS A0 INNER JOIN PHONE_NUMBER A1 ON
A0.PHONE_NUMBER_ID=A1.PHONE_NUMBER_ID WHERE A1.RF_TELKO_ID = '65'
as an alternative you could use a report-query:
ReportQueryByCriteria reportQuery =
QueryFactory.newReportQuery(Calls.class, crit);
reportQuery.setAttributes(new String[]{"count(*)"});
Iterator iter = broker.getReportQueryIteratorByQuery(reportQuery);
hth
jakob
Thomas Franke schrieb:
> Hans Novak wrote:
>
>> yes, this was my first way too. But the "addSql" will insert this sql
>> script after "select ... from .. [here will be inserted]"
> I see.
>
> Regards,
>
> Thomas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org