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;
--
------------------------------------------------------------------------
Repcom Datentechnik GmbH <http://www.repcom.de/>
Hauptstr. 103
63110 Rodgau
Tel. 06106-638081 - Fax 06106-638083
Bankverbindung:
Deutsche Bank Dietzenbach,
Kto. 1516400 BLZ 50570024
Öffnungszeiten:
Mo.-Fr. 14.00-18.30 Uhr
Tel. Hotline Mo.-Fr. 10.00-18.30 Uhr
Messenger
Yahoo
ICQ
: bforpc
: 174290900
MSN
AIM
: [EMAIL PROTECTED]
: bforpc
IP Telefon Skype : bforpc
Unsere Web Adressen
www.repcom.de <http://www.repcom.de> www.refas.de <http://www.refas.de>
www.dataportal.de <http://www.dataportal.de>
Nützliche Links:
Unsere AGB's <http://www.repcom.de/conditions.php>
Infos zu Dateianhängen
<http://www.fsf.org/philosophy/no-word-attachments.de.html>
Anfahrtsbeschreibung <http://www.repcom.de/bilder/repcomanfahrt.jpg>
Repcom Online Hilfe <http://www.repcom-help.de>
Vertraulichkeitshinweis
Der Inhalt dieser E-Mail, einschliesslich etwaiger Anhäge, ist
vertraulich und nur für den oben bezeichneten Adressaten bestimmt. Wenn
Sie nicht dieser Adressat oder dessen Empfangsvertreter sein sollten, so
beachten Sie bitte, dass jede Form der Kenntnisnahme, Veröffentlichung,
Vervielfältigung, Weitergabe oder eines anderen Gebrauchs des Inhalts
nicht gestattet ist und gesetzeswidrig sein kann. Bitte informieren Sie
in diesem Fall unverzglich den Absender und vernichten Sie dieses E-Mail
nebst Anhängen und aller Kopien.
------------------------------------------------------------------------