You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Don <do...@yahoo.com> on 2010/12/03 22:15:26 UTC

Question on LoadableDetachableModel

Hi, 

I would suspect that having a class like below I wouldnt really need to use a LoadableDetachableModel model because I dont store it in some field of the class (or any of the components used by it) so if the page gets stored into session, that wouldnt bloat the session. 

Am I right in my thinking here, please?

public class ResultPage extends WebPage {
    // note no model stored as private fields of some type
    // DocumentModel model;
    
    public ResultPage(DocumentModel docModel) {
        // ...
    }
}

Tks


      

Re: Question on LoadableDetachableModel

Posted by tetsuo <ro...@gmail.com>.
The purpose of the LoadableDetachableModel is to not hold the data
itself between requests, just a 'handle' that loads it from
'somewhere' on demand.

If in the constructor of the page you just pull the data and pass it
to components, they will hold the reference to it, and everything will
be serialized with the page.




On Fri, Dec 3, 2010 at 7:51 PM, Don <do...@yahoo.com> wrote:
> Does it matter as long as I use it only in the c-tor(s)? I could have something like this:
>
> Document doc = model.getObject();
> add(new Label("doc_name", doc.getName()));
> add(new Label("doc_size", doc.getSize()));
>
> But I could have also something else, with dropdowns etc.
>
> --- On Fri, 12/3/10, James Carman <ja...@carmanconsulting.com> wrote:
>
>> From: James Carman <ja...@carmanconsulting.com>
>> Subject: Re: Question on LoadableDetachableModel
>> To: dev@wicket.apache.org
>> Date: Friday, December 3, 2010, 11:43 PM
>> What do you do with "docModel" in
>> that constructor?
>>
>> On Fri, Dec 3, 2010 at 4:15 PM, Don <do...@yahoo.com>
>> wrote:
>> > Hi,
>> >
>> > I would suspect that having a class like below I
>> wouldnt really need to use a LoadableDetachableModel model
>> because I dont store it in some field of the class (or any
>> of the components used by it) so if the page gets stored
>> into session, that wouldnt bloat the session.
>> >
>> > Am I right in my thinking here, please?
>> >
>> > public class ResultPage extends WebPage {
>> >     // note no model stored as private fields of
>> some type
>> >     // DocumentModel model;
>> >
>> >     public ResultPage(DocumentModel docModel) {
>> >         // ...
>> >     }
>> > }
>> >
>> > Tks
>> >
>> >
>> >
>> >
>>
>
>
>
>

Re: Question on LoadableDetachableModel

Posted by Sven Meier <sv...@meiers.net>.
As long as you don't keep a reference to "doc", there's no need for a
model.

If you're pulling a lot of fields out of your "doc" instance (e.g. many
huge strings), your session size could still benefit from a LDM.

Regards

Sven

On Fri, 2010-12-03 at 13:51 -0800, Don wrote:
> Does it matter as long as I use it only in the c-tor(s)? I could have something like this:
> 
> Document doc = model.getObject();
> add(new Label("doc_name", doc.getName()));
> add(new Label("doc_size", doc.getSize()));
>  
> But I could have also something else, with dropdowns etc.
> 
> --- On Fri, 12/3/10, James Carman <ja...@carmanconsulting.com> wrote:
> 
> > From: James Carman <ja...@carmanconsulting.com>
> > Subject: Re: Question on LoadableDetachableModel
> > To: dev@wicket.apache.org
> > Date: Friday, December 3, 2010, 11:43 PM
> > What do you do with "docModel" in
> > that constructor?
> > 
> > On Fri, Dec 3, 2010 at 4:15 PM, Don <do...@yahoo.com>
> > wrote:
> > > Hi,
> > >
> > > I would suspect that having a class like below I
> > wouldnt really need to use a LoadableDetachableModel model
> > because I dont store it in some field of the class (or any
> > of the components used by it) so if the page gets stored
> > into session, that wouldnt bloat the session.
> > >
> > > Am I right in my thinking here, please?
> > >
> > > public class ResultPage extends WebPage {
> > >     // note no model stored as private fields of
> > some type
> > >     // DocumentModel model;
> > >
> > >     public ResultPage(DocumentModel docModel) {
> > >         // ...
> > >     }
> > > }
> > >
> > > Tks
> > >
> > >
> > >
> > >
> > 
> 
> 
>       



Re: Question on LoadableDetachableModel

Posted by Don <do...@yahoo.com>.
Does it matter as long as I use it only in the c-tor(s)? I could have something like this:

Document doc = model.getObject();
add(new Label("doc_name", doc.getName()));
add(new Label("doc_size", doc.getSize()));
 
But I could have also something else, with dropdowns etc.

--- On Fri, 12/3/10, James Carman <ja...@carmanconsulting.com> wrote:

> From: James Carman <ja...@carmanconsulting.com>
> Subject: Re: Question on LoadableDetachableModel
> To: dev@wicket.apache.org
> Date: Friday, December 3, 2010, 11:43 PM
> What do you do with "docModel" in
> that constructor?
> 
> On Fri, Dec 3, 2010 at 4:15 PM, Don <do...@yahoo.com>
> wrote:
> > Hi,
> >
> > I would suspect that having a class like below I
> wouldnt really need to use a LoadableDetachableModel model
> because I dont store it in some field of the class (or any
> of the components used by it) so if the page gets stored
> into session, that wouldnt bloat the session.
> >
> > Am I right in my thinking here, please?
> >
> > public class ResultPage extends WebPage {
> >     // note no model stored as private fields of
> some type
> >     // DocumentModel model;
> >
> >     public ResultPage(DocumentModel docModel) {
> >         // ...
> >     }
> > }
> >
> > Tks
> >
> >
> >
> >
> 


      

Re: Question on LoadableDetachableModel

Posted by James Carman <ja...@carmanconsulting.com>.
What do you do with "docModel" in that constructor?

On Fri, Dec 3, 2010 at 4:15 PM, Don <do...@yahoo.com> wrote:
> Hi,
>
> I would suspect that having a class like below I wouldnt really need to use a LoadableDetachableModel model because I dont store it in some field of the class (or any of the components used by it) so if the page gets stored into session, that wouldnt bloat the session.
>
> Am I right in my thinking here, please?
>
> public class ResultPage extends WebPage {
>     // note no model stored as private fields of some type
>     // DocumentModel model;
>
>     public ResultPage(DocumentModel docModel) {
>         // ...
>     }
> }
>
> Tks
>
>
>
>