Hi Marco,

Yup, there was a thread last week (started by me) about the PersitenceBroker.getCount(...) method...
Current implementation of getCount() just ignores the group-by clause, so your approch is from my point of view absolutely correct.


About the Hsqldb and Oracle difference:
I do not know exactly how Hsqldb works, but Hsqldb is an in-memory database and also after releasing the persistence broker, it is possible that the jdbc layer doesn't release the open 'in-memory' cursors, differently than an Oracle connection. This is only my guess, maybe somebody else has a better explanation.


ciao
danilo


Hi, my answer is a little late for you :


Hi,


For count with a query, you have
broker.getCount(query)
It will make select count(*) from ... without using
an iterator


I know the existence of broker.getCount(query), but i
have to count the rows grouped by the user_id; in
other words i need to retrieve something like this:

count | user_id
  3   |    1
  6   |    2
...

the broker.getReportQuery... function seemed to me to
match my needs. Am i wrong?


Second thing for using iterator (you can have this
problem later) :


I was not aware of this problem with Iterator. I'll
check my code.
Thanx u very much for the advices :)

Marco

There is a big problem with Iterators, when you
don't take all the lines of
the iterator (you have 50 lines to get with your
select but you stop at 30th
line), you will have a problem with cursors in your
database (in a moment,
you'll have all yours cursors used and can't open a
new cursor).
For resolve this problem, you can use OJBIterator
instead of Iterator (You
cast the Iterator in OJBIterator), in the end of the
method, you use
releaseDbResources(), it will close the cursor from
the database.



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