Hi,

if you want to call size() on a query you need to create a "scrollable" query as the 
algorithym uses the underlying database cursor to go to the end of the resultset, get 
the rownumber and then calculate size from there. when you call "execute" on the Query 
object you have an option to pass a boolean representing if you want it scrollable or 
not. Pass true and your size will work. Forward-only queries are used by default as 
they are faster than scrollable cursors.

Note: due to the way Castor builds 1:N queries your resultset size could be off. There 
is no workaround except for stepping through every single entry and getting a count 
that way.

-----Original Message-----
From: Jeff Klann [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 11, 2002 3:15 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] forward only result set?



This is loading an object through Oracle with the thin driver. The error 
occurs when I try to call .size() on a QueryResults object.

Does that help? Don't have a stack trace offhand, I'll look it up later.

~ jeff

At 03:00 PM 7/11/2002 -0700, Krzysztof Swietlinski wrote:
>It looks like JDBC driver exception. Could you post a
>full stack trace and details about what driver you are
>using.
>Cheers,
>Krzysztof
>--- Jeff Klann <[EMAIL PROTECTED]> wrote:
> >
> > Does anyone have any idea what this means?
> >
> > >org.exolab.castor.jdo.PersistenceException,Invalid
> > operation for forward
> > >only resultset : last
> >
> > I just do an OQL query, iterate through it, and
> > close it. Nothing sketchy.
> >
> > cheers,
> > jeff klann
> >
> >
>-----------------------------------------------------------
> >
> > If you wish to unsubscribe from this mailing, send
> > mail to
> > [EMAIL PROTECTED] with a subject of:
> >       unsubscribe castor-dev
> >
>
>
>__________________________________________________
>Do You Yahoo!?
>Sign up for SBC Yahoo! Dial - First Month Free
>http://sbc.yahoo.com
>
>-----------------------------------------------------------
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev

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

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

Reply via email to