do you iterate over the Iterator returned by broker.getReportQueryIteratorByQuery(query) after closing the broker?
(i do not see that from your code)
if yes, then you have to extract all data from the Iterator before closing the broker, otherwise the iterator will be empty...
cheers danilo
Hi all,
in my application i'm using oracle9i & ojbrc4 and i'm stucked with the following problem:
I need to count how many records I have in a table; to do that i've written this code:
---------------------------
Iterator iter = null;
Criteria criteria = buildCriteria();
try {
tx = m_odmg.newTransaction();
tx.begin();
PersistenceBroker broker = ((HasBroker) tx).getBroker(); ReportQueryByCriteria query = QueryFactory.newReportQuery( PrestazioniEffettuateBO.class, criteria);
query.setColumns(new String[] { "count(*)", "id_user" }); query.addGroupBy("id_user");
iter = broker.getReportQueryIteratorByQuery(query); tx.commit(); } catch (Exception ex) { .... } ------------------- which generates the following query (printed from spy.log): ------------------- SELECT count(*),A0.ID_USER FROM PRESTAZIONI_EFFETTUATE A0 WHERE ( (A0.ID_SCHEDE_POLIMORFICHE = '5' ) AND A0.ID_PRESTAZIONE = '1' ) AND (A0.STATO <> 'A' OR (A0.STATO IS NULL )) GROUP BY A0.ID_USER -------------------
The problem is that the returned Iterator is empty but if i run the query in the SQLPlus everthing works just fine!!
The same code works perfectly using HSQLDB.
I've searched the mailing list but i've found nothing. Anybody could give me a hit? Is that a bug? I need to move to RC5?
Thanx in advance
Marco ------------------------------------- Marco Trincardi ------------------------------------- e-mail: [EMAIL PROTECTED] [EMAIL PROTECTED] Yahoo Messenger: iltrink0 ICQ Number: 7161369 ------------------------------------- "Coding Ain't Done 'Till All the Tests Run" -------------------------------------
--------------------------------------------------------------------- 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]
