hi hans,

if you have the relationships properly defined, you'll not have to care about the joins.

Criteria crit = new Criteria();
crit.addEqual("telcoId", new Integer(65));
ReportQueryByCriteria q = QueryFactory.newReportQuery(Calls.class, crit);
q.setAttributes(new String[]{"count(*)"});

Iterator iter = broker.getReportQueryIteratorByQuery(q);

as an alternative (if you're only interested in the count) you can use:


int count = broker.getCount(q);

Hans Novak schrieb:
Hi,

this is already done before (and working).
I can read and write to the database (mysql) with ojb criterias and querys.
My problem is, how i write the criterias and querys that will be translated to a sql command like described.

Hans

Jakob Braeuchi schrieb:
hi hans,

first you need to define all your classes and their relationships in the repository.xml . and then you could execute a report query selecting count(*).

hth
jakob

Hans Novak schrieb:
Hi,

i try many hours (without a result) to query this sql statement:

SELECT count(*) FROM CALLS c, PHONE_NUMBER p, RFTELCO r
WHERE c.PHONE_NUMBER_ID = p.PHONE_NUMBER_ID AND p.RF_TELKO_ID=r.RF_TELKO_ID
   AND r.RF_TELKO_ID =65;


Java Classes are CALLS, PHONE_NUMBER an RFTELCO.

PLEASE PLEASE HELP ME !




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

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.20/233 - Release Date: 18.01.2006


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to