One more thing: just as a rule of thumb, what would be a reasonable
amount of data that gets added to the session for a single request?
20k? 100k?

Regards,

J.



Michael Sparer wrote:
I took a cursory glance over your code and saw

 item.add(new Link("update", new Model(auftrag))

this way the "auftrag" gets into your session, you should say
item.getModel() there instead of new Model(auftrag)

check your code if there is similar stuff in it - spotting those things
might be quite tedious, but you could e.g. temporarily remove the
"Serializable" from your model-classes and go spotting nonserializable
exceptions until they don't ocurr anymore.
hope that helps a bit - and thanks for beating leverkusen in 2000 ;-)

regards,
Michael

Jürgen Lind-2 wrote:
After some twiddling I found that the PagingNavigator seems to be the
culprit.
If I leave it out, the session grows only moderately, when I put it in,
the
domain objects end up in the session... Anyway here is the code:

public class AuftragUebersicht extends MasterLayout {

   @SpringBean
   private AuftragBA auftragBA;

   public AuftragUebersicht() {
     this.initComponents();
   }

   private void initComponents() {

     final AuftragDataView auftragDataView = new
AuftragDataView("resultList",
         new AuftragDataProvider(AuftragUebersicht.this.auftragBA), 10);

     Form form = new Form("searchForm") {

       public Form initComponents() {
         final TextField auftragsnummerField = new
TextField("auftragsnummer",
                                                              new
Model(""));
         add(auftragsnummerField);

         Button searchButton = new Button("search") {
           public void onSubmit() {
             String auftragsnummer =
auftragsnummerField.getModelObjectAsString();

             AuftragDataProvider p = (AuftragDataProvider)
                                      auftragDataView.getDataProvider();
             p.setQuery(new AuftragUebersichtQuery(auftragsnummer));

             if (auftragDataView.getDataProvider().size() == 0) {
               AuftragUebersicht.this.info("No results found!");
             }
           }
         };
         add(searchButton);

         return this;
       }

     }.initComponents();

     WebMarkupContainer resultListContainer = new
WebMarkupContainer("resultListContainer") {
       public boolean isVisible() {
         return auftragDataView.getDataProvider().size() > 0;
       }
     };

     CheckGroup group = new CheckGroup("group", new
ArrayList<PartnerAuftrag>());

     group.add(new CheckGroupSelector("groupselector"));

     group.add(auftragDataView);

     resultListContainer.add(new PagingNavigator("navigator",
auftragDataView));

     resultListContainer.add(group);

     form.add(resultListContainer);

     this.add(form);

   }
}

public class AuftragDataView extends DataView {

   public AuftragDataView(String id, IDataProvider dataProvider, int
itemsPerPage) {
     super(id, dataProvider, itemsPerPage);
   }

   @Override
   protected void populateItem(final Item item) {

     final PartnerAuftrag auftrag = (PartnerAuftrag)
item.getModelObject();
     item.add(new Label("auftragsnummer", auftrag.getAuftragsnummer()));
     ...

     item.add(new Link("update", new Model(auftrag)) {
       public void onClick() {
         AuftragBearbeiten page = new AuftragBearbeiten((PartnerAuftrag)
getModelObject());
         setResponsePage(page);
       }
     });

     item.add(new AttributeModifier("class", true, new
AbstractReadOnlyModel() {
       public Object getObject() {
         return (item.getIndex() % 2 == 1) ? "even" : "odd";
       }
     }));
   }

   @Override
   protected void onDetach() {
     super.onDetach();
   }
}

public class AuftragDataProvider implements IDataProvider {

   private AuftragBA                  auftragBA;
   private AuftragUebersichtQuery     query;

   private Collection<PartnerAuftrag> result;

   public AuftragDataProvider(AuftragUebersichtQuery query, AuftragBA
auftragBA) {
     this.query = query;
     this.auftragBA = auftragBA;
   }

   public AuftragUebersichtQuery getQuery() {
     return this.query;
   }

   public void setQuery(AuftragUebersichtQuery query) {
     this.query = query;
     this.result = null;
   }

   public Iterator<PartnerAuftrag> iterator(int first, int count) {
     if (this.result == null) {
       this.performQuery();
     }
     return new ArrayList<PartnerAuftrag>(this.result).subList(first,
first + count).iterator();
   }

   public IModel model(final Object object) {
     return new DetachablePartnerAuftragModel((PartnerAuftrag) object,
this.auftragBA);
   }

   public int size() {
     if (this.result == null) {
       this.performQuery();
     }
     return this.result.size();
   }

   public void detach() {
     this.result = null;
   }

   private void performQuery() {
     ...
   }
}


public class DetachablePartnerAuftragModel extends LoadableDetachableModel
{

   private Long      id;
   private AuftragBA auftragBA;

   public DetachablePartnerAuftragModel(PartnerAuftrag auftrag, AuftragBA
auftragBA) {
     this(auftrag.getAuftragsId(), auftragBA);
   }

   public DetachablePartnerAuftragModel(Long id, AuftragBA auftragBA) {
     this.id = id;
     this.auftragBA = auftragBA;
   }

   @Override
   protected Object load() {
     return this.auftragBA.findAuftragByAuftragsId(this.id);
   }

   @Override
   protected void onDetach() {
     super.onDetach();
   }
}

Michael Sparer wrote:
 > the objects shouldn't be serialized into the session if you're using
 > loadabledetachable models, please show us some code
 >
 > regards,
 > Michael
 >
 >
 > Jürgen Lind-2 wrote:
 >> Hi,
 >>
 >> I have a question on how the DataView component is supposed to work.
In my
 >> application, I have to show quite large list of entities and so I am
using
 >> a DataView together with LoadableDetachableModels to read the data on
 >> demand.
 >> However, when looking at the serialized sessions, I can observe that
the
 >> session size constantly increases by a fairly large amount although I
am
 >> just using the navigator to page through the list. Also, when looking
into
 >> the serialized session, I can see that the objects that are supposed
to
 >> be reloaded on demand are serialized into the session as well.
 >>
 >> Is this the behavior that I would expect from the DataView or am I
making
 >> some mistake here?
 >>
 >> Regards,
 >>
 >> J.
 >>
 >> --
 >> Dr. Jürgen Lind
 >> iteratec GmbH                Fon: +49 (0)89 614551-44
 >> Inselkammerstrasse 4         Fax: +49 (0)89 614551-10
 >> 82008 Unterhaching           Web: www.iteratec.de
 >>
 >> Sitz und Registergericht der iteratec GmbH: München HRB 113 519
 >> Geschäftsführer: Klaus Eberhardt, Mark Goerke, Inge Hanschke, Ralf
Menzel
 >>
 >>
 >> ---------------------------------------------------------------------
 >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 >> For additional commands, e-mail: users-h...@wicket.apache.org
 >>
 >>
 >>
 >
 >
 > -----
 > Michael Sparer
 > http://talk-on-tech.blogspot.com

--
Mit freundlichen Grüßen,

Jürgen Lind

--
Dr. Jürgen Lind
iteratec GmbH                Fon: +49 (0)89 614551-44
Inselkammerstrasse 4         Fax: +49 (0)89 614551-10
82008 Unterhaching           Web: www.iteratec.de

Sitz und Registergericht der iteratec GmbH: München HRB 113 519
Geschäftsführer: Klaus Eberhardt, Mark Goerke, Inge Hanschke, Ralf Menzel


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org





-----
Michael Sparer
http://talk-on-tech.blogspot.com

--
Mit freundlichen Grüßen,

Jürgen Lind

--
Dr. Jürgen Lind
iteratec GmbH                Fon: +49 (0)89 614551-44
Inselkammerstrasse 4         Fax: +49 (0)89 614551-10
82008 Unterhaching           Web: www.iteratec.de

Sitz und Registergericht der iteratec GmbH: München HRB 113 519
Geschäftsführer: Klaus Eberhardt, Mark Goerke, Inge Hanschke, Ralf Menzel


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to