if you stored this list in a field (lazy init it), i imagine the provider would not hit the db after loading the list the first time. it might also work to set an item reuse strategy (don't know, i've never tried this since i stopped trying to optimize away from detachable models). of course, even when you get this working, you will end up with all the downsides i mentioned.
Jonathan Locke wrote: > > > try setting a breakpoint on this line: > > List certificateList = > > DAOManager.getExemptionCertificateDAO().getExemptionCertificates( > > m_certificateSearchCriteriaName,m_certificateSearchCriteriaValue, > Integer.valueOf(first), Integer.valueOf(count)); > > i assume the data view has to get the iterator each time to repopulate the > list (since it's refreshing). > > > mfs wrote: >> >> >> >> Jonathan Locke wrote: >>> >>> >>> oh, okay. sorry, i was speed-reading your question and misunderstood >>> it. >>> >>> maurice and johan are correct that hybrid urls will avoid creating the >>> instance. the part i mistakenly assumed we were talking about was >>> whether one can completely avoid creating a new version of the page in >>> the page store during rendering. maybe matej can verify this, but i >>> don't think that is possible anymore. wicket requests can dynamically >>> modify the component hierarchy and with the new disk page store, i think >>> you always end up with a new page version. so when you hit a hybrid url >>> and a new page version is created and that number at the end of the url >>> changes (which i'm assuming you are assuming is a new page), that >>> doesn't mean a new page was constructed (set a breakpoint in your >>> constructor and verify for yourself). it merely means that the existing >>> page was mutated. is that where your confusion is coming from? >>> >>> So For me 1) Doing a refresh, doesnt change/increment the version at the >>> end of url, it remains the same with every refresh 2) the confusion is >>> that i see the model being reloaded from the database (even though i am >>> not using a DetachableModel), may be i am doing something wrong here (or >>> probably i am not understanding something correctly), if u look at my >>> implementation here (http://papernapkin.org/pastebin/view/788/) may be >>> you can tell, because if a a new page is not constructed on a refresh >>> (given hybridstrategy), why is the DataView repopulated/reconstructed >>> every time with the latest model (provided to it via a IDataProvider >>> impl which in turns get the data from the DB and, yes also the model >>> returned by the DataProvider.model(Object object) is non-detachable >>> model)...I think i am missing something very basic yet important here.. >>> >>> btw, i still think you are making a big mistake if you're avoiding >>> detachable models. detachable models are the best practice. you should >>> add a database cache to make them efficient, not try to work around >>> them. early on i tried to avoid them at first and discovered dozens of >>> ways to get bit by that. don't prematurely optimize your app. build it >>> the right way first and then look at your hot spots. >>> >>> I will re-think this over defintly and u certainly seem to make sense, >>> but i would still wanna have a good understanding of how this works.. >>> >>> >>> Jonathan Locke wrote: >>>> >>>> >>>> okay, so i think the answer to your question is no, you can't optimize >>>> that. you should be using detachable models and an OTS db cache. >>>> >>>> what i don't understand is why you want to do this. if the user hits >>>> refresh in their browser they are hoping to see updated data. why do >>>> you want to turn that into a no-op? >>>> >>>> >>>> mfs wrote: >>>>> >>>>> I have the condensed version of the code here, with some comments on >>>>> the top of each class.. >>>>> >>>>> http://papernapkin.org/pastebin/view/788/ >>>>> >>>>> Waiting for follow up >>>>> >>>>> >>>>> Jonathan Locke wrote: >>>>>> >>>>>> >>>>>> you must be making some mistake (probably conceptual). can you >>>>>> create a quickstart example of your problem and post it at some link >>>>>> where we can see exactly what you're doing? >>>>>> >>>>>> >>>>>> mfs wrote: >>>>>>> >>>>>>> Well actually before posting this up, i did try this i.e. mounted >>>>>>> the page using hybridurlcodingstrategy (with the assumption that >>>>>>> since the pageId is there in the url doing a refresh would load the >>>>>>> already instantiated page against the id) but at that time i had the >>>>>>> page as bookmarkable (i.e. had public default and param >>>>>>> constructors), so after reading maurice's post, i made it a >>>>>>> non-bookmarkable one (by making both the constructors as protected) >>>>>>> but unfortunately it still doesnt work, doing a refresh i still see >>>>>>> the updated model..to be precise i am using a DataView which is a >>>>>>> IDataProvider and am using non-detachable models. >>>>>>> >>>>>>> Thanks for the follow up.. >>>>>>> >>>>>>> >>>>>>> >>>>>>> Johan Compagner wrote: >>>>>>>> >>>>>>>> HybridUrlEnoding >>>>>>>> >>>>>>>> On Sun, May 11, 2008 at 9:04 AM, mfs <[EMAIL PROTECTED]> >>>>>>>> wrote: >>>>>>>> >>>>>>>>> >>>>>>>>> Guys, >>>>>>>>> >>>>>>>>> Firstly, Is that a right understanding that doing a >>>>>>>>> browser-refresh of the >>>>>>>>> page would result in a new instance of the page being created >>>>>>>>> everytime and >>>>>>>>> similarly a new model instance would be binded to the page. >>>>>>>>> >>>>>>>>> Is there a way one can use the same version of the page/model >>>>>>>>> (which wicket >>>>>>>>> kept in the session) when the page was rendered the first time.. >>>>>>>>> >>>>>>>>> I would want to avoid a hit to the database on refresh (since my >>>>>>>>> model >>>>>>>>> construction requires so) >>>>>>>>> -- >>>>>>>>> View this message in context: >>>>>>>>> http://www.nabble.com/Load-serialized-%28or-in-session%29-page-model-on-refresh..-tp17170105p17170105.html >>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com. >>>>>>>>> >>>>>>>>> >>>>>>>>> --------------------------------------------------------------------- >>>>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>>>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > -- View this message in context: http://www.nabble.com/Load-serialized-%28or-in-session%29-page-model-on-refresh..-tp17170105p17181661.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
