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