hi hans,
imo you should post the relevant parts of your repository.
jakob
Hans Novak schrieb:
hi,
hmm.... im not shure, but this is not enough, because the the sql
statement will look like this:
SELECT
RF_TELKO_ID,PARTNER_ID_USER,FIRST_NAME,LAST_NAME,NAME_SUFFIX,STREET,ZIP,CITY
FROM RFTELCO WHERE RF_TELKO_ID = 65
and
SELECT A0.PHONE_NUMBER_ID,A0.RF_TELKO_ID,A0.NUMBER FROM PHONE_NUMBER A0
WHERE A0.RF_TELKO_ID = 65
and
SELECT count(*) FROM CALLS A0 WHERE RF_TELKO_ID = 65
In Calls i dont have an "RF_TELKO_ID" and i get an mysql error.
Your try will translate my wish in 3 seperate SQL querys.
How can i use the ReportQueryByCriteria with more then one class, or is
it a chance to give the broker a native SQL script, without a class ?
Hans
Jakob Braeuchi schrieb:
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;
------------------------------------------------------------------------
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]