Hi,
I have a simple OQLQuery that fetches all records from a table, and before 
reading the results I want to read the size of the results, here is a code 
snipet:

try
                {                       
                        db = jdo.getDatabase();
                        db.begin();
                        oql = db.getOQLQuery("SELECT c FROM Table c");
                        qry = oql.execute();
                        if(logger.isDebugEnabled())
                                logger.debug("myMethod/size: " + qry.size());
                        db.commit();
                        db.close();
                }
                catch(Exception e)
                {
                        logger.error("myMethod", e);
                }
                return qry;

I get the following exception, because of calling the qry.size() while trying 
to log it. logger is an instance of log4j Logger.

Here is the exception below:

org.exolab.castor.jdo.PersistenceException: Invalid operation for forward only 
resultset : last
        at 
org.exolab.castor.jdo.engine.SQLEngine$SQLQuery.size(SQLEngine.java:1735)
        at org.exolab.castor.persist.QueryResults.size(QueryResults.java:253)
        at 
org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.size(OQLQueryImpl.java:568)
        at si.hermes.mojplanet.core.DBManager.getChannels(DBManager.java:49)
        at TestDBM.main(TestDBM.java:21)


As far as I can recall with 0.9.5.3 this was OK to do. Has something changed?

This is the 0.9.6, I've downloaded it yesterday.

Regards,
Emir



----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to