The DataObject would need to be an argument to nextPage(), etc.
Basically this is doing the same thing you were suggesting, but it
gets rid of the Pager API.

Brent

On 11/8/06, Kevin Williams <[EMAIL PROTECTED]> wrote:
I am probably missing something.  If we stash the page size and number
in the root data object how would that info get back to the command for
the next page request?
--
Kevin


Brent Daniel wrote:

> Technically it's fine, but conceptually I'm not sure about passing a
> command object to a pager. What does it mean to page a command?
>
> Another option would be to get rid of the Pager altogether. The only
> state held in the Pager if you get rid of the Command is the page size
> and current index. We could easily stash those on the root DataObject
> (even in the static case we will have a containing DataObject created
> by the DAS.) Then you could move nextPage(), previousPage(), and
> getPage() to Command.
>
> Brent
>
>
> On 11/8/06, Kevin Williams <[EMAIL PROTECTED]> wrote:
>
>> The RDB DAS currently has a simple paging capability that is implemented
>> by wrapping a Command.  Here is a simple example:
>>
>>        // Build command to read all customers
>>        Command readCustomers = das.createCommand("select * from
>> CUSTOMER order by ID");
>>
>>        // Create a pager with page size 15
>>        Pager pager = new PagerImpl(custCommand, 15);
>>
>>        // Get and work with first page
>>        DataObject root = pager.next();
>>
>>        // Get and work with the second page
>>        root = pager.next();
>>
>>        // First page again
>>        root = pager.previous();
>>
>>
>> This works well if the client of the page data is on the server but not
>> so well if the client is not.   The reason is that the pager wraps a
>> command instance which, in turn, references a connection.  For a pager
>> to work in a "disconnected" mode it should probably be serializable and
>> very lightweight (it might be stored in session for instance) and it
>> cannot count on the original connection to be available.  I think this
>> could easily be achieved by removing the instance variable from the
>> pager that references it's command.  Instead, the command can  be passed
>> as an argument to the paging methods like this:
>>
>>      DataObject root = pager.next(someReadCommand);
>>
>> Does this sound reasonable?
>>
>> --
>> Kevin
>>
>>
>> ---------------------------------------------------------------------
>> 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]



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

Reply via email to