> Hi Marco,

Hi Danilo,

> 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...

You're right!!! 
My function returns the Iterator found with the
getReportQuery function and i iterate over it in the
caller. If i copy the content before closing the
broker everithing works fine.

What drove me nuts was that using HyperSqlDb (which is
my development database, oracle9i is the production
db) the iterator was Not empty after closing the
broker.
Just to satisfy my curiosity, anybody could explain
why i have this (incorrect) behaviour in Hsqldb?

Danilo, Thank u very much for your help

Ciao

Marco
> 
> 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]
> 


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

Reply via email to