Finally, there _is_ a portable trick for retrieving the total number of rows a query would
return:
| ScrollableResults resultCountCursor = session.createQuery(q).scroll();
| resultCountCursor.last();
| long count = resultCountCursor.getRowNumber() + 1
| resultCountCursor.close();
|
| // Now do a q.llist() to retrieve the result
|
The problem here is that the crap JDBC drivers of certain databases (MySQL) do retrieve
the resultset of server-side cursors to the client, which would usually result in an OOME
- especially if the resultset is large and you actually want to paginate through it.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067237#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...