So what I'm hearing is that I have to use the Detachable model, but that I
can build in some caching to prevent unnecessary datastore access.

Thanks.


On Tue, Jun 11, 2013 at 1:11 PM, Marios Skounakis <msc...@gmail.com> wrote:

> This example is not quite optimized. The DetachableContactModel's
> constructor is
>
> public DetachableContactModel(Contact c)
>     {
>         this(c.getId());
>     }
>
> but it should be:
>
>
> public DetachableContactModel(Contact c)
>     {
>         this(c.getId());
>         setObject(c);
>     }
>
> The way it's done in the example although the model is given the contact,
> it stores only its id and needs to load it from the database in order to
> access it, even while rendering the table. The way I suggest the model is
> given the contact and does not need to load it.
>
> So, the way it's done in the example database access is as follows:
> - a list query to get the contacts for a given page
> - n queries by id, one for each row
>
> The way I'm suggesting database access is as follows:
> - a list query to get the contacts for a give page
> - no other queties
>
> If the row contains say a link column that accesses the row model in the
> ajax click, then you will see an additional database access by id when the
> DetachableContactModel is attached.
>
> Cheers
> Marios
>
>
> On Tue, Jun 11, 2013 at 6:56 PM, Daniel Watrous <dwmaill...@gmail.com
> >wrote:
>
> > Hi,
> >
> > I'm following the example in the repeaters section for paging through
> large
> > amounts of data:
> >
> >
> http://www.wicket-library.com/wicket-examples-6.0.x/repeater/wicket/bookmarkable/org.apache.wicket.examples.repeater.PagingPage
> >
> > Based on the example and how I've had to implement this there is a lot of
> > data access. First is in the ContactDataProvider. The function iterator
> > queries for the set of data that will be displayed.
> >
> > Next, all the objects that are returned need to be wrapped in
> > a DetachableContactModel. The load mechanism here then loads each
> > individual object from the datastore.
> >
> > In the example, the data is in memory. In a real world scenario the data
> is
> > likely to be remote and this setup could have a significant performance
> > impact.
> >
> > Is there some way to cut out some of the data access? For example, can I
> > get rid of DetachableContactModel and just use the data retrieved through
> > the ContactDataProvider?
> >
> > Thanks,
> > Daniel
> >
>

Reply via email to